Prerequisites
Make sure you complete the following steps before you proceed:
Determine the account to enable for Smart Tap
Before continuing, you will need to identify which account will be designated as the Redemption Issuer account. There are two ways to determine this:
Create a new Issuer account
The account contact information of the new account must contain the merchant’s information. For instructions on how to do this in the Google Pay & Wallet Console, refer to this support article The following code sample demonstrates creating an Issuer account using the Google Wallet API:
Java
/** * Create a new Google Wallet Issuer account. * * @param issuerName The Issuer's name. * @param issuerEmail The Issuer's email address. * @throws IOException */ public void CreateIssuerAccount(String issuerName, String issuerEmail) throws IOException { // New Issuer information Issuer issuer = new Issuer() .setName(issuerName) .setContactInfo(new IssuerContactInfo().setEmail(issuerEmail)); Issuer response = service.issuer().insert(issuer).execute(); System.out.println("Issuer insert response"); System.out.println(response.toPrettyString()); }
PHP
/** * Create a new Google Wallet issuer account. * * @param string $issuerName The Issuer's name. * @param string $issuerEmail The Issuer's email address. */ public function createIssuerAccount(string $issuerName, string $issuerEmail) { // New Issuer information $issuer = new Google_Service_Walletobjects_Issuer([ 'name' => $issuerName, 'contactInfo' => new Google_Service_Walletobjects_IssuerContactInfo([ 'email' => $issuerEmail, ]), ]); $response = $this->service->issuer->insert($issuer); print "Issuer insert response\n"; print_r($response); }
Python
def create_issuer_account(self, issuer_name: str, issuer_email: str): """Create a new Google Wallet Issuer account. Args: issuer_name (str): The Issuer's name. issuer_email (str): The Issuer's email address. """ # New Issuer information issuer = {'name': issuer_name, 'contactInfo': {'email': issuer_email}} # Make the POST request response = self.http_client.post(url=self.issuer_url, json=issuer) print('Issuer insert response') print(response.text)
C#
/// <summary> /// Create a new Google Wallet Issuer account. /// </summary> /// <param name="issuerName">The Issuer's name.</param> /// <param name="issuerEmail">The Issuer's email address.</param> public void CreateIssuerAccount(string issuerName, string issuerEmail) { // New issuer information Issuer issuer = new Issuer() { ContactInfo = new IssuerContactInfo() { Email = issuerEmail }, Name = issuerName, }; Stream responseStream = service.Issuer .Insert(issuer) .ExecuteAsStream(); StreamReader responseReader = new StreamReader(responseStream); JObject jsonResponse = JObject.Parse(responseReader.ReadToEnd()); Console.WriteLine("Issuer insert response"); Console.WriteLine(jsonResponse.ToString()); }
Node.js
/** * Create a new Google Wallet Issuer account. * * @param {string} issuerName The Issuer's name. * @param {string} issuerEmail The Issuer's email address. */ async createIssuerAccount(issuerName, issuerEmail) { // New Issuer information let issuer = { name: issuerName, contactInfo: { email: issuerEmail } }; let response = await this.httpClient.request({ url: this.issuerUrl, method: 'POST', data: issuer }); console.log('Issuer insert response'); console.log(response); }
Initially, only the principal (service account or user) who created the Issuer account will have access. You will need to update the permissions of the Issuer account to include any additional users or service accounts that should be able to manage passes. The following code sample demonstrates updating Issuer account permissions.
Java
/** * Update permissions for an existing Google Wallet Issuer account. * * <p><strong>Warning:</strong> This operation overwrites all existing permissions! * * <p>Example permissions list argument below. Copy the add entry as needed for each email address * that will need access. Supported values for role are: 'READER', 'WRITER', and 'OWNER' * * <pre><code> * ArrayList<Permission> permissions = new ArrayList<Permission>(); * permissions.add(new Permission().setEmailAddress("emailAddress").setRole("OWNER")); * </code></pre> * * @param issuerId The Issuer ID being used for this request. * @param permissions The list of email addresses and roles to assign. * @throws IOException */ public void UpdateIssuerAccountPermissions(String issuerId, ArrayList<Permission> permissions) throws IOException { Permissions response = service .permissions() .update( Long.parseLong(issuerId), new Permissions().setIssuerId(Long.parseLong(issuerId)).setPermissions(permissions)) .execute(); System.out.println("Issuer permissions update response"); System.out.println(response.toPrettyString()); }
PHP
/** * Update permissions for an existing Google Wallet Issuer account. * * **Warning:** This operation overwrites all existing permissions! * * Example permissions list argument below. Copy the entry as * needed for each email address that will need access. Supported * values for role are: 'READER', 'WRITER', and 'OWNER' * * $permissions = array( * new Google_Service_Walletobjects_Permission([ * 'emailAddress' => 'email-address', * 'role' => 'OWNER', * ]), * ); * * @param string $issuerId The Issuer ID being used for this request. * @param array $permissions The list of email addresses and roles to assign. */ public function updateIssuerAccountPermissions(string $issuerId, array $permissions) { // Make the PUT request $response = $this->service->permissions->update( $issuerId, new Google_Service_Walletobjects_Permissions([ 'issuerId' => $issuerId, 'permissions' => $permissions, ]) ); print "Permissions update response\n"; print_r($response); }
Python
def update_issuer_account_permissions(self, issuer_id: str, permissions: List): """Update permissions for an existing Google Wallet Issuer account. **Warning:** This operation overwrites all existing permissions! Example permissions list argument below. Copy the dict entry as needed for each email address that will need access. Supported values for role are: 'READER', 'WRITER', and 'OWNER' permissions = [ { 'emailAddress': 'email-address', 'role': 'OWNER' } ] Args: issuer_id (str): The Issuer ID being used for this request. permissions (List): The list of email addresses and roles to assign. """ response = self.http_client.put(url=f'{self.permissions_url}/{issuer_id}', json={ 'issuerId': issuer_id, 'permissions': permissions }) print('Permissions update response') print(response.text)
C#
/// <summary> /// Update permissions for an existing Google Wallet Issuer account. /// <para /> /// <strong>Warning:</strong> This operation overwrites all existing permissions! /// <para /> /// Example permissions list argument below. Copy the add entry as needed for each email /// address that will need access.Supported values for role are: 'READER', 'WRITER', and 'OWNER' /// <para /> /// <![CDATA[List<Permission> permissions = new List<Permission>();]]> /// <para /> /// permissions.Add(new Permission { EmailAddress = "emailAddress", Role = "OWNER"}); /// </summary> /// <param name="issuerId">The issuer ID being used for this request.</param> /// <param name="permissions">The list of email addresses and roles to assign.</param> public void UpdateIssuerAccountPermissions(string issuerId, List<Permission> permissions) { Stream responseStream = service.Permissions .Update(new Permissions { IssuerId = long.Parse(issuerId), PermissionsValue = permissions }, long.Parse(issuerId)) .ExecuteAsStream(); StreamReader responseReader = new StreamReader(responseStream); JObject jsonResponse = JObject.Parse(responseReader.ReadToEnd()); Console.WriteLine("Issuer permissions update response"); Console.WriteLine(jsonResponse.ToString()); }
Node.js
/** * Update permissions for an existing Google Wallet Issuer account. * * **Warning:** This operation overwrites all existing permissions! * * Example permissions list argument below. Copy the dict entry as * needed for each email address that will need access. Supported * values for role are: 'READER', 'WRITER', and 'OWNER' * * let permissions = [ * { * 'emailAddress': 'email-address', * 'role': 'OWNER', * }, * ]; * * @param {string} issuerId The Issuer ID being used for this request. * @param {Array} permissions The list of email addresses and roles to assign. */ async updateIssuerPermissions(issuerId, permissions) { let response = await this.httpClient.request({ url: `${this.permissionsUrl}/${issuerId}`, method: 'PUT', data: { issuerId: issuerId, permissions: permissions } }); console.log('Permissions update response'); console.log(response); }
Use an existing account
The following criteria should be used to determine if you can use an Issuer account that contains existing pass classes.
- If the Issuer account for pass development contains classes for other merchants, you must set up a new account on behalf of the merchant.
- If your issuer account for pass development only contains classes for that specific merchant, it can be used.
If the account meets these criteria, you must update the contact information in the business profile with the merchant’s information to make sure the account name identifies the merchant. Only you should have API access to this account. Additional pass developers should make their own Issuer accounts.
Redemption Issuer account configuration
Use the Google Pay & Wallet Console
In the Redemption Issuer account, you will need to follow the below steps:
- Navigate to the Google Wallet API section
- Select Additional features
- Select Add an authentication key
- Upload a public key (
.pem
file) and specify a key version - Select Create authentication key
The Collector ID will be provided to you once the authentication key is successfully uploaded.
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEchyXj869zfmKhRi9xP7f2AK07kEo
4lE7ZlWTN14jh4YBTny+hRGRXcUzevV9zSSPJlPHpqqu5pEwlv1xyFvE1w==
-----END PUBLIC KEY-----
Use the Google Wallet API
Upload a public key
To assign public keys and key versions using the Google Wallet API, you will
need to make a PATCH
request to the Issuers endpoint.
PATCH https://walletobjects.googleapis.com/walletobjects/v1/issuer/{issuerId}
The PATCH
request body will look similar to the following:
{
"smartTapMerchantData": {
"authenticationKeys": [
{
"id": 1,
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----"
},
{
"id": 2,
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----"
}
]
}
}
The following code sample demonstrates updating an Issuer account to include the demo public key mentioned previously:
Java
/** * Add a new public key to an Issuer account. * * @param issuerId The issuer ID being used for this request. * @throws IOException */ public void AddSmartTapKey(Long issuerId) throws IOException { // New smart tap key information Issuer patchBody = new Issuer() .setSmartTapMerchantData( new SmartTapMerchantData() .setAuthenticationKeys( Arrays.asList( new AuthenticationKey() .setId(1) .setPublicKeyPem( "-----BEGIN PUBLIC KEY-----\n" + "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEchyXj869zfmKhRi9xP7f2AK07kEo\n" + "4lE7ZlWTN14jh4YBTny+hRGRXcUzevV9zSSPJlPHpqqu5pEwlv1xyFvE1w==\n" + "-----END PUBLIC KEY-----")))); Issuer response = service.issuer().patch(issuerId, patchBody).execute(); System.out.println("Issuer patch response"); System.out.println(response.toPrettyString()); }
PHP
/** * Add a new public key to an Issuer account. * * @param string $issuerId The issuer ID being used for this request. */ public function addSmartTapKey(string $issuerId) { // New smart tap key information $patchBody = new Google_Service_Walletobjects_Issuer([ 'smartTapMerchantData' => new Google_Service_Walletobjects_SmartTapMerchantData([ 'authenticationKeys' => [ new Google_Service_Walletobjects_AuthenticationKey([ 'id' => 1, 'publicKeyPem' => "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEchyXj869zfmKhRi9xP7f2AK07kEo\n4lE7ZlWTN14jh4YBTny+hRGRXcUzevV9zSSPJlPHpqqu5pEwlv1xyFvE1w==\n-----END PUBLIC KEY-----" ]) ] ]) ]); $response = $this->service->issuer->patch($issuerId, $patchBody); print "Issuer patch response\n"; print_r($response); }
Python
def add_smart_tap_key(self, issuer_id: str) -> str: """Add a new public key to an Issuer account. Args: issuer_id (str): The issuer ID being used for this request. """ # New smart tap key information patch_body = { 'smartTapMerchantData': { 'authenticationKeys': [{ 'id': 1, 'publicKeyPem': '-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEchyXj869zfmKhRi9xP7f2AK07kEo\n4lE7ZlWTN14jh4YBTny+hRGRXcUzevV9zSSPJlPHpqqu5pEwlv1xyFvE1w==\n-----END PUBLIC KEY-----' }] } } # Make the PATCH request response = self.http_client.patch(url=f'{self.issuer_url}/{issuer_id}', json=patch_body) print('Issuer patch response') print(response.text) return response.json()['smartTapMerchantData']['smartTapMerchantId']
C#
/// <summary> /// Add a new public key to an Issuer account. /// </summary> /// <param name="issuerId">The issuer ID being used for this request.</param> public void AddSmartTapKey(long issuerId) { // New smart tap key information Issuer patchBody = new Issuer() { SmartTapMerchantData = new SmartTapMerchantData { AuthenticationKeys = new List<AuthenticationKey> { new AuthenticationKey { Id = 1, PublicKeyPem = "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEchyXj869zfmKhRi9xP7f2AK07kEo\n4lE7ZlWTN14jh4YBTny+hRGRXcUzevV9zSSPJlPHpqqu5pEwlv1xyFvE1w==\n-----END PUBLIC KEY-----" } } } }; Stream responseStream = service.Issuer .Patch(patchBody, issuerId) .ExecuteAsStream(); StreamReader responseReader = new StreamReader(responseStream); JObject jsonResponse = JObject.Parse(responseReader.ReadToEnd()); Console.WriteLine("Issuer patch response"); Console.WriteLine(jsonResponse.ToString()); }
Node.js
/** * Add a new public key to an Issuer account. * * @param {string} issuerId The issuer ID being used for this request. */ async addSmartTapKey(issuerId) { // New smart tap key information let patchBody = { smartTapMerchantData: { authenticationKeys: [ { id: 1, publicKeyPem: '-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEchyXj869zfmKhRi9xP7f2AK07kEo\n4lE7ZlWTN14jh4YBTny+hRGRXcUzevV9zSSPJlPHpqqu5pEwlv1xyFvE1w==\n-----END PUBLIC KEY-----' } ] } }; let response = await this.httpClient.request({ url: `${this.issuerUrl}/${issuerId}`, method: 'PATCH', data: patchBody }); console.log('Issuer patch response'); console.log(response); }
The response will include the body you sent and an extra field,
smartTapMerchantData.smartTapMerchantId
. This is the Collector ID of the
Redemption Issuer account.
Obtain the Collector ID
After adding any keys and key versions, you can use the Google Wallet API to get
your Collector ID by making a GET
request to the Issuers endpoint.
GET https://walletobjects.googleapis.com/walletobjects/v1/issuer/{issuerId}
Java
/** * Get the Collector ID for an Issuer account. * * @param issuerId The issuer ID being used for this request. * @return The Collector ID * @throws IOException */ public Long GetCollectorId(Long issuerId) throws IOException { Issuer response = service.issuer().get(issuerId).execute(); System.out.println("Issuer patch response"); System.out.println(response.toPrettyString()); return response.getSmartTapMerchantData().getSmartTapMerchantId(); }
PHP
/** * Get the Collector ID for an Issuer account. * * @param string $issuerId The issuer ID being used for this request. * @return string The Collector ID. */ public function getCollectorId(string $issuerId) { $response = $this->service->issuer->get($issuerId); print "Issuer get response\n"; print_r($response); return $response['smartTapMerchantData']['smartTapMerchantId']; }
Python
def get_collector_id(self, issuer_id: str) -> str: """Get the Collector ID for an Issuer account. Args: issuer_id (str): The issuer ID being used for this request. """ # Make the GET request response = self.http_client.get(url=f'{self.issuer_url}/{issuer_id}') print('Issuer get response') print(response.text) return response.json()['smartTapMerchantData']['smartTapMerchantId']
C#
/// <summary> /// Get the Collector ID for an Issuer account. /// </summary> /// <param name="issuerId">The issuer ID being used for this request.</param> /// <returns>The Collector ID</returns> public string GetCollectorId(long issuerId) { Stream responseStream = service.Issuer .Get(issuerId) .ExecuteAsStream(); StreamReader responseReader = new StreamReader(responseStream); JObject jsonResponse = JObject.Parse(responseReader.ReadToEnd()); Console.WriteLine("Issuer get response"); Console.WriteLine(jsonResponse.ToString()); return jsonResponse["smartTapMerchantData"]["smartTapMerchantId"].Value<string>(); }
Node.js
/** * Get the Collector ID for an Issuer account. * * @param {string} issuerId The issuer ID being used for this request. * * @returns {string} The Collector ID */ async getCollectorId(issuerId) { let response = await this.httpClient.request({ url: `${this.issuerUrl}/${issuerId}`, method: 'GET' }); console.log('Issuer patch response'); console.log(response); return response.data.smartTapMerchantData.smartTapMerchantId; }
The response will include the field, smartTapMerchantData.smartTapMerchantId
.
This is the Collector ID of the Redemption Issuer account.
Issuer account management
Pass organization
There are two common approaches for managing pass classes and objects for multiple merchants:
- One central Issuer account for all merchants
- One new Issuer account for each merchant
For example, Foo-Loyalty manages separate loyalty programs for two merchants: ILuvCoffee and TeaLuv. Their pass classes can be managed in either of the following ways:
Approach | Description |
---|---|
Single Issuer account | Contain all loyalty classes under one Issuer account "Foo-Loyalty." This option is recommended if you plan to keep track of where your passes are redeemable at the class level. It's also a good option if you never grant your merchants API access to that Issuer account. |
Separate Issuer accounts | Make two separate Issuer accounts: "iLuvCoffee via Foo-Loyalty" and "teaLuv via Foo-Loyalty." This option is recommended if you want to assume that all classes under a certain Issuer account are redeemable at the merchant level, or if you plan to give merchants API access to the Issuer account. |
Redemption Issuer account
There are two scenarios to consider when determining the correct Redemption Issuer account to use.
Scenario 1: The merchant is already using Smart Tap
If the merchant confirms they can already redeem from Google Wallet with their terminals (the merchant is already set up as a Redemption Issuer), follow the below steps:
- Request the merchant's Redemption Issuer ID
- Add the merchant's Redemption Issuer ID to the
redemptionIssuers
property of your pass class
Scenario 2: The merchant is new to Smart Tap
In this scenario, the merchant has terminals that support Smart Tap but hasn't utilized the feature. The merchant, terminal provider, or pass developer will need to perform one-time setup to enable Smart Tap on the merchant's terminals.
For more information, see Merchant configuration.