This new API, navigator.mozPay(), Mozilla says, was inspired by Google’s Wallet for Digital Goods API and will ship in Firefox OS first and then be added to Firefox for Android and desktop Firefox later. While it’s currently a very experimental API (and still incomplete), Mozilla expects that it will be usable enough to “process live payments on the first Firefox OS phones and evolve quickly from real-world usage.”
The question to ask here, of course, is why bother, given that online payments don’t seem to be a major issue for users and developers, thanks to services like PayPal and Stripe. Mozilla, however, argues that users should have more choice when it comes to how they want to pay for goods online (be they virtual or physical). Users, the organization also notes, still have to type in their credit card numbers, which “is like giving someone the keys to your expensive car, letting them drive it around the block in a potentially dangerous neighborhood (the web) and saying please don’t get carjacked!”
With navigator.mozPay(), developers will be able to grant permission to each payment provider they want to work with and use a very straightforward process for handling these payments that’s more about exchanging tokens than exchanging credit card information.
You can find more details about how to implement and test the current version of this API here.