So you finished your app or browser extension and now would like to implement a payment system for in-app purchases. You want to sell extra features or virtual goods, but you don’t know where to start. There are many choices and a lot of the implementation seems daunting.
No worries. Google Payments to the rescue! With it, you can immediately start accepting in-app purchases. Furthermore, Google Payments and the Chrome Web Store will keep track of the user for you, so no matter which computer your user uses, your extension will always be able to recognize what he or she has already bought!
Below we will walk through the basic steps.
getSkuDetailsmethod and to initiate a buy, call the
getPurchasesand see if the item is still listed and is “ACTIVE”. If it is a virtual good like a game item and your user uses the purchase up, you can call the
consumePurchasemethod to remove the item from the user.
Our recent Chrome browser extension Twinword Finder implements this payment method. Users can easily pay through Google Payments to upgrade our extension to a PRO Paid version. We don’t handle any payments (whew!), Google does it all.
To see the payment flow in action, after installing the extension, open it, click on the settings icon, and click PRO Paid in the Upgrade options to see the Google Wallet window invoked.