Open payment system for Firefox OS
Mozilla has released an early draft version of a payment service API, enabling Firefox OS app developers to process purchases. The API design is in part based on Google Wallet, but the WebPayment API will remain open to being used for a wide range of payment service providers.
When a purchase is made, the web app invokes the
navigator.mozPay function, which ideally should offer a choice of payment service providers. The developer has to provide data in the form of a signed JSON web token (JWT) for each provider. The web token includes the provider's address, unique IDs for the app and product and URLs for use with successful and failed processing events. The price is specified in the form of tiered price points.
The JWT is then sent to the payment service provider; in order to process the information in the token, the provider has to offer the WebPaymentProvider interface. Mozilla has released initial implementations in Python and Node.js, with further implementations to follow.
App developers can already test the WebPayment API, though currently only Firefox Marketplace is able to process these payments. Available payment methods are currently limited to credit cards and mobile phone billing. Mozilla advises developers to undertake thorough prior testing of payment processing using the
simulate flag. At present, there do not appear to be any plans to integrate the API into the browser or to have it recognised as a web standard.