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
- Sign into the Google Cloud Platform and enable the Google Wallet API for your GCP project.
- If you don’t already have a GCP project, create one.
- Enable the Google 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: email@example.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: firstname.lastname@example.org.
- 3. Select Developer for Access level.
- 4. Click Invite.
5. Create a class
Before you can create and add a
LoyaltyObject, you must create a
To do so, sign in into the Google Pay and Wallet Console,
navigate to the Google Wallet API page, and create a new Loyalty class.
- Make sure you are on Manage tab
- You should see "You're in demo mode" if this is your first time ever creating a pass.
- 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.
- Click on Create a class
- Choose Loyalty
- Fill up all mandatory fields marked with *
- Click on Create class
Repeat the steps on this page if you require multiple loyalty cards.
Refer to the Layout template for more information on how these attributes are represented on the pass.After you successfully create a Loyalty class, proceed to Add passes to Google Wallet.