Today's #bitcoin-dev featured an interesting discussion of mobile phone use, centered around the following use case:
- customer walks into real-world stores, selects several items, and walks to cashier to check out
- cashier displays QR-code on customer-facing screen
- customer uses mobile phone to take picture of QR-code
- mobile phone displays "Big Box Store Corporation, Inc, requests a payment of 300 BTC. Do you agree? Yes / No"
- customer agrees (or cancels the sale), triggering BTC transfer from customer to merchant
As such, tcatm, nelisky and I started typing out notes for APIs at http://www.bitcoin.org/wiki/doku.php?id=phone_api
I'll let tcatm or nelisky talk about payment requests if they wish, but I wanted to focus on defining a QR-code specification that people could start using immediately.
Each of these is a text string in the style of RFC822 headers (“key: value”), where “value” is further separated by semicolons. Strings containing semicolons or spaces may be quoted with double-quotes ("). Double-quotes themselves are escaped in the obvious way, with a back-slash.
1) Bitcoin address. Not directly related to the purchase-via-mobile-phone scenario just described, but obviously necessary.
bitcoin-address1: name="John Q. Public"; pubkey=1LGpwDU5djqsR1X14Tcass3y9fULTzxJq3
Using this QR-code, you may share bitcoin addresses with others via mobile phone. Use this QR-code on the forum or your website, to give out your bitcoin donation address!
2) Merchant request for direct payment via bitcoin network.
btcpayment-request1: name=“My Bitcoin Inc.”; pubkey=1LGpwDU5djqsR1X14Tcass3y9fULTzxJq3; amount=300
Using this QR-code, the mobile phone knows enough to ask the user if they wish to pay 300 BTC to My Bitcoin, Inc. at the given bitcoin address. Presumably the mobile phone has the ability to make bitcoin payments, either directly (a lightweight bitcoin client) or indirectly via a payment API such as this
3) Merchant request for indirect payment via a custom payment processor.
payment-request1: merchant=1234; name=“My Bitcoin Inc.”; tx_id=1234bacd;
payment-processor=http://mtgox.com/apiv1; api=mtgox; amount=300; currency=BTC
Using this QR-code, assuming that the mobile phone app is aware of an API known as "mtgox", the mobile phone knows enough to ask the user if they wish to pay 300 BTC to My Bitcoin, Inc., using the specified custom Web API.
The "1" suffix implies version 1 of that QR-code. An incompatible change would imply "bitcoin-address1" becomes "bitcoin-address2", etc.