Mozilla Previews Web Payments Interface

Mozilla has launched the WebPayment API, intended as a more decentralised, smartphone-friendly alternative to PayPal

The Mozilla Foundation has released a draft web application programming interface (API) for an open payment system adapted particularly for mobile devices, an area it says is not well served by existing systems such as PayPal, Stripe and others.

The WebPayment API makes use of the navigator.mozPay() function, which will first be tested in the Firefox OS mobile operating system, before heading for wider deployment in Firefox browsers for Android and desktop operating systems.

Mobile integration

Mozilla said it is also planning to work with the World Wide Web Consortium on reaching a “consensus” on a common API supporting web payments “in the best way possible”, according to Kumar McMillan, a developer for Firefox OS and the Firefox Marketplace.

McMillan said the API is intended to mitigate the complications involved in accepting payments over the web, and to do so in a way better suited to web devices than PayPal, Stripe and other existing systems.

mozilla-foundation“Mozilla wants to introduce a common web API to make payments easy and secure on web devices yet still as flexible as the checkout button for merchants,” McMillan said in a blog post. “As a first step, Mozilla will introduce navigator.mozPay() in Firefox OS so that web apps can accept payments.”

The navigator.mozPay() function is inspired by Google Wallet, but “modified for things like multiple payment providers and carrier billing”, according to McMillan.

When a web application invokes the function, the device shows a secure window allowing the user to authenticate and then to charge a payment to a mobile carrier bill or credit card.

Open interface

“There is no concept of what product is purchased, it’s just an API to facilitate a payment for a digital good or service, whatever that may be,” McMillan wrote. “The payment starts and finishes in the client but further processing and notifications happen server-side.”

Ideally the user should be offered a choice of payment service providers, with the developer responsible for providing a JSON web token for each provider. The token includes the provider’s address, unique IDs for the application and product and URLs for use with successful and failed processing events, McMillan said.

The token is sent to the payment service provider, which must offer the WebPaymentProvider interface in order to process it; implementations of this interface are currently available in the Python and Node.js languages, with further implementations planned.

Currently only the Firefox Marketplace application marketplace is able to process payments, with payment methods limited to credit cards and mobile phone billing.

McMillan said that ideally, WebPayment should be a step toward a more decentralised environment for Internet payments, which could even deplace advertising by making it easier for web users to pay directly for content.


“In a more webby model, all parties involved in the payment would be fully decentralised so that innovation can occur naturally and unknown payment providers could emerge,” McMillan wrote. “An elegant API would support that.”

He said that while payments aren’t yet fully live in the Firefox Marketplace, developers can test the API by simulating payments using a “simulate” tag. Once the developer is ready to make the payments system live, they can simply remove the tag in order to accept real payment.

“Navigator.mozPay() is an experimental API and might change drastically or become unprefixed without notice,” McMillan wrote. “It will process live payments on the first Firefox OS phones and evolve quickly from real world usage.”

In February PayPal launched PayPal Here, a smartphone-based payment system that makes it easier for cash-based businesses to accept digital payments. Interested businesses can download an app onto their Android or iOS device and purchase a “revolutionary” card reader that is small enough to fit in a pocket but can still handle Chip and PIN payments.

Do you know all about 4G and the mobile future? Take our quiz.