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

// New issuer name
final String issuerName = "name";

// New issuer email address
final String issuerEmail = "email-address";

// Issuer API endpoint
GenericUrl issuerUrl = new GenericUrl("https://walletobjects.googleapis.com/walletobjects/v1/issuer");

// New issuer information
HashMap<String, Object> issuerPayload = new HashMap<String, Object>() {
  {
    put("name", issuerName);
    put("contactInfo", new HashMap<String, String>() {
      {
        put("email", issuerEmail);
      }
    });
  }
};

HttpRequest issuerRequest = httpRequestFactory.buildPostRequest(
    issuerUrl,
    new JsonHttpContent(GsonFactory.getDefaultInstance(), issuerPayload));
HttpResponse issuerResponse = issuerRequest.execute();

System.out.println("issuer POST response: " + issuerResponse.parseAsString());

PHP

// New issuer name
$issuerName = 'name';

// New issuer email address
$issuerEmail = 'email-address';

// Issuer API endpoint
$issuerUrl = 'https://walletobjects.googleapis.com/walletobjects/v1/issuer';

// New issuer information
$issuerPayload = <<<EOD
{
  "name": $issuerName,
  "contactInfo": {
    "email": $issuerEmail
  }
}
EOD;

$issuerResponse = $httpClient->post(
  $issuerUrl,
  ['json' => json_decode($issuerPayload)]
);

echo 'issuer POST response: ' .  $issuerResponse->getBody();

Python

# New issuer name
ISSUER_NAME = "name"

# New issuer email address
ISSUER_EMAIL = "email-address"

# Issuer API endpoint
ISSUER_URL = "https://walletobjects.googleapis.com/walletobjects/v1/issuer"

# New issuer information
issuer_payload = {
    "name": ISSUER_NAME,
    "contactInfo": {
        "email": ISSUER_EMAIL
    }
}

# Make the POST request
issuer_response = http_client.post(
    url=ISSUER_URL,
    json=issuer_payload
)

print("issuer POST response:", issuer_response.text)

C#

// New issuer name
string issuerName = "name";

// New issuer email address
string issuerEmail = "email-address";

// Issuer API endpoint
string issuerUrl = "https://walletobjects.googleapis.com/walletobjects/v1/issuer";

// New issuer information
var issuerPayload = new
{
  name = issuerName,
  contactInfo = new
  {
    email = issuerEmail
  }
};

HttpRequestMessage issuerRequest = new HttpRequestMessage(HttpMethod.Post, issuerUrl);
issuerRequest.Content = new StringContent(JsonConvert.SerializeObject(issuerPayload));
HttpResponseMessage issuerResponse = httpClient.Send(issuerRequest);

Console.WriteLine($"issuer POST response: {await issuerResponse.Content.ReadAsStringAsync()}");

Node.js

// New issuer name
const issuerName = 'name';

// New issuer email address
const issuerEmail = 'email-address';

// Issuer API endpoint
const issuerUrl = 'https://walletobjects.googleapis.com/walletobjects/v1/issuer';

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

let issuerResponse = await httpClient.request({
  url: issuerUrl,
  method: 'POST',
  data: issuerPayload
});

console.log('issuer POST response:', issuerResponse);

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

// Permissions API endpoint
GenericUrl permissionsUrl = new GenericUrl(
    "https://walletobjects.googleapis.com/walletobjects/v1/permissions/" + issuerId);

ArrayList<HashMap<String, String>> permissions = new ArrayList<>();

// Copy as needed for each email address that will need access
permissions.add(new HashMap<String, String>() {
  {
    put("emailAddress", "email-address");
    put("role", "READER | WRITER | OWNER");
  }
});

// New issuer permissions information
HashMap<String, Object> permissionsPayload = new HashMap<String, Object>() {
  {
    put("issuerId", issuerId);
    put("permissions", permissions);
  }
};

HttpRequest permissionsRequest = httpRequestFactory.buildPutRequest(
    permissionsUrl,
    new JsonHttpContent(GsonFactory.getDefaultInstance(), permissionsPayload));
HttpResponse permissionsResponse = permissionsRequest.execute();

System.out.println("permissions PUT response: " + permissionsResponse.parseAsString());

PHP

// Permissions API endpoint
$permissionsUrl = "https://walletobjects.googleapis.com/walletobjects/v1/permissions/{$issuerId}";

// New issuer permissions information
// Copy objects in permissions as needed for each email that will need access
$permissionsPayload = <<<EOD
{
  "issuerId": $issuerId,
  "permissions": [
    {
      "emailAddress": "email-address",
      "role": "READER | WRITER | OWNER"
    },
  ]
}
EOD;

# Make the PUT request
$permissionsResponse = $httpClient->put(
  $permissionsUrl,
  ['json' => json_decode($permissionsPayload)]
);

echo 'permissions PUT response: ' .  $permissionsResponse->getBody();

Python

# Permissions API endpoint
permissions_url = f"https://walletobjects.googleapis.com/walletobjects/v1/permissions/{ISSUER_ID}"

# New issuer permissions information
permissions_payload = {
    "issuerId": ISSUER_ID,
    "permissions": [
        # Copy as needed for each email address that will need access
        {
            "emailAddress": "email-address",
            "role": "READER | WRITER | OWNER"
        },
    ]
}

permissions_response = http_client.put(
    permissions_url,
    json=permissions_payload
)

print("permissions PUT response:", permissions_response.text)

C#

// Permissions API endpoint
string permissionsUrl = $"https://walletobjects.googleapis.com/walletobjects/v1/permissions/{issuerId}";

// New issuer permissions information
var permissionsPayload = new
{
  issuerId = issuerId,
  permissions = new object[]
  {
  // Copy as needed for each email address that will need access
  new
  {
    emailAddress = "email-address",
    role = "READER | WRITER | OWNER"
  }
  }
};

HttpRequestMessage permissionsRequest = new HttpRequestMessage(HttpMethod.Put, permissionsUrl);
permissionsRequest.Content = new StringContent(JsonConvert.SerializeObject(permissionsPayload));
HttpResponseMessage permissionsResponse = httpClient.Send(permissionsRequest);

Console.WriteLine($"permissions PUT response: {await permissionsResponse.Content.ReadAsStringAsync()}");

Node.js

// Permissions API endpoint
permissionsUrl = `https://walletobjects.googleapis.com/walletobjects/v1/permissions/${issuerId}`;

// New issuer permissions information
permissionsPayload = {
  issuerId: issuerId,
  permissions: [
    // Copy as needed for each email address that will need access
    {
      emailAddress: 'email-address',
      role: 'READER | WRITER | OWNER'
    }
  ]
};

let permissionsResponse = await httpClient.request({
  url: permissionsUrl,
  method: 'PUT',
  data: permissionsPayload
});

console.log('permissions PUT response:', permissionsResponse);