You can use the Google Wallet for Digital Goods API to sell digital and virtual goods in a web application. The Google Wallet for Digital Goods platform has been built with simplicity in mind. It has a simple API for you to integrate with, a simple interface for buyers to interact with, and a simple pricing model.
Note: If you're developing an Android app, you should instead use Google Play In-app billing.
Video: Introducing Google Wallet for Digital Goods
What is the Google Wallet for Digital Goods API?
The Google Wallet for Digital Goods API enables you to accept payments within your web app. Because in-app purchases are fast and feel natural to buyers, they're ideal for selling virtual and digital goods, which are bought often and used right away.
The experience is even better for people who have already purchased an Android app, a Chrome Web Store app, or Picasa storage. Because those people are already Google Wallet buyers, they don't need to re-enter billing information when paying you.
You can add Google Wallet for Digital Goods to your app with just a few lines of code. In return, you get the power of Google's payments infrastructure, with PCI compliance, risk control, and many other benefits.
To find example apps that use this API, see Samples.
How to use the API
To use the API, you must provide both client-side and server-side code.
Your server-side code creates a JSON Web Token (JWT) for each item that can be purchased. (The client uses this JWT when it calls the Google Wallet for Digital Goods API.) Your server must also acknowledge the HTTP POST message that Google sends when a purchase completes.
Tip: If you track user identities, we encourage you to use Google Account identities (with Google's OpenID endpoint). When buyers are already logged into their Google Accounts, the purchase flow is smoother.
The following figure gives an overview of the flow of control when an app uses the Google Wallet for Digital Goods API.
The numbers in the figure correspond to key steps in the purchase process:
- Your server creates a JWT for the item to be purchased.
Your client detects when the user wants to buy an item,
responding by calling the API's
- The user confirms the purchase.
- Google's server sends your server a purchase notification, using the postback URL that you specify. Within 10 seconds, your server acknowledges the purchase by sending a response to Google's server.
- Google charges the order, and your client's success handler is called.
- Your client confirms the transaction with your server and updates its UI to reflect the purchase.