Create issuer accounts programmatically

Stay organized with collections Save and categorize content based on your preferences.

As you integrate with Google Wallet, it may be convenient to use multiple issuer accounts. For example, if your business manages issuer accounts and passes on behalf of clients, you can create separate issuer accounts for each. Your first issuer account must be complete and approved before you can access the REST API. After this, you can programmatically create additional accounts and adjust the emails shared with them.

You can also create an issuer account manually in the Google Pay and Wallet Console by following the steps in the Manage multiple businesses support article. Once you create a business, you can invite new users and manage their access levels.

Create a new issuer account

To create a new issuer account, use an authorized service account to call the issuer.insert method. The response body will include the original request details and the newly created issuer account ID.

POST https://walletobjects.googleapis.com/walletobjects/v1/issuer/

For more information on how to use the issuer endpoint, see the API reference.

Request

{
  "name": issuer-account-name
  "contactInfo": {
    "email": email-address
  }
}

Response

{
  "issuerId": string
  "name": string
  "contactInfo": {
    "email": string
  }
}

The following code samples demonstrate creating a new issuer account using the provided name and email address. Once created, additional users and service accounts can be granted access.

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.
    """
    # Issuer API endpoint
    issuer_url = f'{self.base_url}/issuer'

    # New Issuer information
    issuer = {
        'name': issuer_name,
        'contactInfo': {
            'email': issuer_email,
        },
    }

    # Make the POST request
    response = self.http_client.post(
        url=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) {
  // Issuer API endpoint
  const issuerUrl = `${this.baseUrl}/issuer`;

  // New Issuer information
  let issuer = {
    name: issuerName,
    contactInfo: {
      email: issuerEmail
    }
  };

  let response = await this.httpClient.request({
    url: issuerUrl,
    method: 'POST',
    data: issuer
  });

  console.log('Issuer insert response');
  console.log(response);
}

Change an existing account's permissions

When a new issuer account is created, access is restricted to only the principal that created it. If you create a new issuer account in the Google Pay & Wallet Console, only you will have access until its permissions are changed. The code samples on this page use a service account key file to authenticate to the Google Wallet APIs. This means that the initial owner of the issuer account will be the service account principal in the key file. Additional service accounts or users will need to be granted access separately. To do this, use the authorized service account to call the issuer.update method. The response will include the permissions specified in the request body.

PUT https://walletobjects.googleapis.com/walletobjects/v1/permissions/{issuerId}

For more information on how to use the permissions endpoint, see the API reference.

Request

{
  "issuerId": issuer-id,
  "permissions": [
    {
      "emailAddress": email-address,
      "role": "READER" | "WRITER" | "OWNER"
    },
    // ...
  ]
}

Response

{
  "issuerId": string,
  "permissions": [
    {
      "emailAddress": string,
      "role": string
    },
    // ...
  ]
}

The following code samples demonstrate updating permissions for a specific issuer ID. Principals are identified by an email address and provided a role (READER, WRITER, or OWNER).

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.
    """
    # Permissions API endpoint
    permissions_url = f'{self.base_url}/permissions/{issuer_id}'

    response = self.http_client.put(
        url=permissions_url,
        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&lt;Permission> permissions = new List&lt;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) {
  // Permissions API endpoint
  const permissionsUrl = `${this.baseUrl}/permissions/${issuerId}`;

  let response = await this.httpClient.request({
    url: permissionsUrl,
    method: 'PUT',
    data: {
      issuerId: issuerId,
      permissions: permissions
    }
  });

  console.log('Permissions update response');
  console.log(response);
}

Smart Tap merchant data

This endpoint can also be used to manage Smart Tap merchant data, including the collector ID and public keys associated with the issuer account. For more information, see Use the API to configure Smart Tap.