Google Wallet for Digital Goods

Overview

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.

Contents

  1. What is the Google Wallet for Digital Goods API?
  2. How to use the API

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 client-side code uses the Google Wallet for Digital Goods API to initiate the purchase flow. It can also provide JavaScript callback handlers, which are called when the purchase flow ends.

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.

see the following text

The numbers in the figure correspond to key steps in the purchase process:

  1. Your server creates a JWT for the item to be purchased.
  2. Your client detects when the user wants to buy an item, responding by calling the API's buy() method.
  3. The user confirms the purchase.
  4. 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.
  5. Google charges the order, and your client's success handler is called.
  6. Your client confirms the transaction with your server and updates its UI to reflect the purchase.

For a walkthrough of writing this code, see the Web tutorial. You can find more code in the Samples page.

Next: Understanding the Purchase Flow

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.