This document explains how to use cURL and the Business Console to test and debug your Google Pay API for Passes integration both locally and remotely. You can use these tools to test your integration against many of the acceptance tests required to launch.
Acceptance testing
Your integration must pass all the tests on the corresponding acceptance testing checklists before you can launch. Work with your Google technical contact, after testing is completed, to plan for launch.
Test your classes and objects using cURL
Your application will use the REST API to create, retrieve, and modify classes and objects. Use cURL to send requests to test the REST end points or view the raw JSON responses.
Obtain an OAuth2 Bearer Token
To obtain a bearerToken
, install the
oauth2l tool
and use it in the following command. Replace pathToPrivateKey with
the Service Account Key path you created as described in the
section that discusses OAuth 2.0 authentication.
oauth2l fetch --scope wallet_object.issuer --credentials pathToPrivateKey --cache ""
The bearerToken
is used as part of the following cURL commands.
Get a specific class or object
Use the following cURL command to get a specific class or object to test if it is being inserted
correctly by your application. Replace walletObjectType with your
class or object type (such as loyaltyClass
or loyaltyObject
) and replace
resourceId with the resourceId
with the ID of the object
or class you want to get. You can use the cURL commands in the following List objects and List
classes sections to get a list of IDs. Then use an ID with this cURL command to retrieve the
specific object or class.
curl GET https://walletobjects.googleapis.com/walletobjects/v1/walletObjectType/resourceId -H "Authorization: Bearer bearerToken"
List classes
Use the following cURL command to list all of the classes for a specific issuerId
or merchant to test that your application is inserting the correct classes. Replace
classType with your class type (such as loyaltyClass
)
and issuerId with your issuerId
.
curl GET https://walletobjects.googleapis.com/walletobjects/v1/classType?issuerId=issuerId -H "Authorization: Bearer bearerToken"
List objects
Use the following cURL command to list all of the objects associated with a specific
classId
and to test that your application is inserting the correct objects. Replace
walletObjectType with your object type (such as
loyaltyObject
) and classId with the object's parent
classId
.
curl GET https://walletobjects.googleapis.com/walletobjects/v1/walletObjectType?classId=classId -H "Authorization: Bearer bearerToken"
Update an object or class
Use the following cURL commands to update a specific object or class:
- Get the object or class and save to a file. Replace
walletObjectType with your object type
(such as
offerObject
orloyaltyClass
) and replace resourceId with theresourceId
with the ID of the object you want to get. Also, replacemyobjectfile.txt
with the name of the local file containing your object.curl -X GET https://walletobjects.googleapis.com/walletobjects/v1/walletObjectType/resourceId -H "Authorization: Bearer bearerToken" > myobjectfile.txt
- Make changes to the values of fields in the object or class.
- Push the update to the object or class:
curl -X PUT https://walletobjects.googleapis.com/walletobjects/v1/walletObjectType/resourceId -H "Authorization: Bearer bearerToken" -H "Content-Type: application/json" -d myobjectfile.txt
Add a message
Use the following cURL command to add a message to a specific object or class. Replace
walletObjectType with your object type (such as
offerObject
or loyaltyObject
) and replace
resourceId with the resourceId
with the ID of the object
whose message you want to set.
curl -X POST -H "Authorization: Bearer bearerToken" -H "Content-Type: application/json" -d '{"message":{"kind":"walletobjects#walletObjectMessage","header":"Welcome to Banconrista Rewards!","body":"Featuring our new bacon donuts.","displayInterval":{"kind":"walletobjects#timeInterval","start":{"date":"1985-04-12T23:20:50.52Z"},"end":{"date":"2085-04-12T23:20:50.52Z"}},"id":"1234"},"reviewStatus":"underReview"}' https://walletobjects.googleapis.com/walletobjects/v1/walletObjectType/resourceId/addMessage
Create a class
Use the following cURL command to create a class. Replace classType
with your class type (such as loyaltyClass
) and classJSON
with your generated class JSON.
curl POST https://walletobjects.googleapis.com/walletobjects/v1/classType -H "Authorization: Bearer bearerToken" -H "Content-Type: application/json" -d 'classJSON'