Prerequisites

Before you use the Google Wallet API for an integration, complete the following steps:

1. Sign up for a Google Wallet API Issuer account

An Issuer account is necessary to create and distribute passes for Google Wallet. Sign up for Google Pay and Wallet Console to get your issuer account. After signing up, navigate to the Google Wallet API page and click Build your first pass. Once you accept the terms of service you can start creating a pass class.

After the above step you can also try out the Codelab.

2. Enable the Wallet API

3. Create a service account

A service account and a service account key are necessary to call the Google Wallet API. The service account is the identity that calls the Google Wallet API. The service account key contains a private key that your application uses to authenticate to the Google Wallet API.

Create a service account:

  • 1.Create a service account in the Google Cloud Console, providing the following details:
    • Service account name - example: Wallet Web Client
    • Service account ID - example: my-service-account
  • 2. Click CREATE AND CONTINUE.
  • 3. Click DONE.

Create a service account key:

  • 1. Select your service account. For example: my-service-account@my-project-id.iam.gserviceaccount.com.
  • 2. Click on the KEYS menu item at the top of the page.
  • 3. Click ADD KEY and Create new key.
  • 4. Select key type JSON.
  • 5. Click CREATE to create and download the service account key.

4. Authorize the service account

You must authorize the service account in order to call the API. To authorize it, grant the service account access to manage your Issuer Account.

  • Visit the Users page in the Google Pay and Wallet Console.
  • 1. Click Invite a user.
  • 2. Add the service account's email address. For example: my-service-account@my-project-id.iam.gserviceaccount.com.
  • 3. Select Developer for Access level.
  • 4. Click Invite.

5. Create a class

Before you can create and add a EventObject, you must create a EventClass. To do so, sign in into the Google Pay and Wallet Console, navigate to the Google Wallet API page, and create a new Event class.

  1. Make sure you are on Manage tab
  2. You should see "You're in demo mode" if this is your first time ever creating a pass.
  3. While in demo mode, click on "Set up test accounts" to add test accounts. Only these accounts will be able to save the passes while your issuer account is in demo mode.
  4. Click on Create a class
  5. Choose Event
  6. Fill up all mandatory fields marked with *
  7. Click on Create class

Repeat the steps on this page if you require multiple event tickets.

Refer to the Layout template for more information on how these attributes are represented on the pass.

After you successfully create a Event class, proceed to Add passes to Google Wallet.