Update Passes Classes and Passes Objects

  • Google Wallet Passes can be updated at the class or object level using either the Google Pay & Wallet Console or the Google Wallet API.

  • When updating passes programmatically, use update to replace the entire resource and patch to modify specific fields, considering their respective behaviors and potential data loss.

  • Updating a class affects all users with passes from that class, while updating an object only impacts the individual user associated with it.

  • Scheduled updates are recommended for time-sensitive information to keep passes current and engaging for users.

  • Before updating, retrieve the latest pass version with a GET request to ensure all desired fields are included in the update and to avoid unintended data removal.

Keeping passes updated is an important way to engage with your customers and build a positive experience.

There are two resources that can be updated: The OfferClass and the OfferObject.

Best Practices

The following list contains helpful information to consider when updating your offer classes and objects:

  • When you want to update an entire class or object, send an update request. When you want to update a small number of fields in a class or object, send a patch request.
  • When you make an update request, the entire object or class is updated. This means that any fields not included in the request will be cleared. Before sending an update request, we recommend you send a GET request to ensure you are working with the latest version and all of the intended fields are included in your request.
  • When making a patch request, only the patched fields are updated. Before sending a patch request, consider optionally sending a GET request to compare your changes against the latest version.
  • When making patch requests to update arrays, the original array is replaced with the one included in the request body. You cannot modify the elements in an array individually.
  • In some cases, you may not know when changes happen, or when to trigger updates. Consider periodically scheduling update or patch requests for all classes and objects.

Update a Passes Class

Use the Google Wallet Business Console

Pass classes (not objects) can be modified directly in the Google Pay & Wallet Console.

  1. Navigate to the console
  2. Select Google Wallet API
  3. Select the class you want to modify
  4. Select Edit
  5. Update the class properties
  6. Select Save

Once you save your changes, the class is updated automatically for any offer holders.

Use the Google Wallet API

Updating the OfferClass affects all users who have been provisioned offers using this class. For example, to update the logo for your offers, you would submit an update or patch request to the Google Wallet API at either of the following endpoints. The resourceId value would be the class ID (ISSUER_ID.CLASS_SUFFIX).

# Update
PUT https://walletobjects.googleapis.com/walletobjects/v1/offerclass/{resourceId}
# Patch
PATCH https://walletobjects.googleapis.com/walletobjects/v1/offerclass/{resourceId}

For more information, see the API reference.

Java

To start your integration in Java, refer to our complete code samples on GitHub.

/**
 * Update a class.
 *
 * <p><strong>Warning:</strong> This replaces all existing class attributes!
 *
 * @param issuerId The issuer ID being used for this request.
 * @param classSuffix Developer-defined unique ID for this pass class.
 * @return The pass class ID: "{issuerId}.{classSuffix}"
 */
publicStringupdateClass(StringissuerId,StringclassSuffix)throwsIOException{
OfferClassupdatedClass;
// Check if the class exists
try{
updatedClass=
service.offerclass().get(String.format("%s.%s",issuerId,classSuffix)).execute();
}catch(GoogleJsonResponseExceptionex){
if(ex.getStatusCode()==404){
// Class does not exist
System.out.printf("Class %s.%s not found!%n",issuerId,classSuffix);
returnString.format("%s.%s",issuerId,classSuffix);
}else{
// Something else went wrong...
ex.printStackTrace();
returnString.format("%s.%s",issuerId,classSuffix);
}
}
// Class exists
// Update the class by adding a homepage
updatedClass.setHomepageUri(
newUri()
.setUri("https://developers.google.com/wallet")
.setDescription("Homepage description"));
// Note: reviewStatus must be 'UNDER_REVIEW' or 'DRAFT' for updates
updatedClass.setReviewStatus("UNDER_REVIEW");
OfferClassresponse=
service
.offerclass()
.update(String.format("%s.%s",issuerId,classSuffix),updatedClass)
.execute();
System.out.println("Class update response");
System.out.println(response.toPrettyString());
returnresponse.getId();
}

PHP

To start your integration in PHP, refer to our complete code samples on GitHub.

/**
 * Update a class.
 *
 * **Warning:** This replaces all existing class attributes!
 *
 * @param string $issuerId The issuer ID being used for this request.
 * @param string $classSuffix Developer-defined unique ID for this pass class.
 *
 * @return string The pass class ID: "{$issuerId}.{$classSuffix}"
 */
public function updateClass(string $issuerId, string $classSuffix)
{
 // Check if the class exists
 try {
 $updatedClass = $this->service->offerclass->get("{$issuerId}.{$classSuffix}");
 } catch (Google\Service\Exception $ex) {
 if (!empty($ex->getErrors()) && $ex->getErrors()[0]['reason'] == 'classNotFound') {
 // Class does not exist
 print("Class {$issuerId}.{$classSuffix} not found!");
 return "{$issuerId}.{$classSuffix}";
 } else {
 // Something else went wrong...
 print_r($ex);
 return "{$issuerId}.{$classSuffix}";
 }
 }
 // Update the class by adding a homepage
 $updatedClass->setHomepageUri(new Uri([
 'uri' => 'https://developers.google.com/wallet',
 'description' => 'Homepage description'
 ]));
 // Note: reviewStatus must be 'UNDER_REVIEW' or 'DRAFT' for updates
 $updatedClass->setReviewStatus('UNDER_REVIEW');
 $response = $this->service->offerclass->update("{$issuerId}.{$classSuffix}", $updatedClass);
 print "Class update response\n";
 print_r($response);
 return $response->id;
}

Python

To start your integration in Python, refer to our complete code samples on GitHub.

defupdate_class(self, issuer_id: str, class_suffix: str) -> str:
"""Update a class.
 **Warning:** This replaces all existing class attributes!
 Args:
 issuer_id (str): The issuer ID being used for this request.
 class_suffix (str): Developer-defined unique ID for this pass class.
 Returns:
 The pass class ID: f"{issuer_id}.{class_suffix}"
 """
 # Check if the class exists
 try:
 response = self.client.offerclass().get(resourceId=f'{issuer_id}.{class_suffix}').execute()
 except HttpError as e:
 if e.status_code == 404:
 print(f'Class {issuer_id}.{class_suffix} not found!')
 return f'{issuer_id}.{class_suffix}'
 else:
 # Something else went wrong...
 print(e.error_details)
 return f'{issuer_id}.{class_suffix}'
 # Class exists
 updated_class = response
 # Update the class by adding a homepage
 updated_class['homepageUri'] = {
 'uri': 'https://developers.google.com/wallet',
 'description': 'Homepage description'
 }
 # Note: reviewStatus must be 'UNDER_REVIEW' or 'DRAFT' for updates
 updated_class['reviewStatus'] = 'UNDER_REVIEW'
 response = self.client.offerclass().update(
 resourceId=f'{issuer_id}.{class_suffix}',
 body=updated_class).execute()
 print('Class update response')
 print(response)
 return f'{issuer_id}.{class_suffix}'

C#

To start your integration in C#, refer to our complete code samples on GitHub.

/// <summary>
/// Update a class.
/// <para />
/// <strong>Warning:</strong> This replaces all existing class attributes!
/// </summary>
/// <param name="issuerId">The issuer ID being used for this request.</param>
/// <param name="classSuffix">Developer-defined unique ID for this pass class.</param>
/// <returns>The pass class ID: "{issuerId}.{classSuffix}"</returns>
publicstringUpdateClass(stringissuerId,stringclassSuffix)
{
// Check if the class exists
StreamresponseStream=service.Offerclass
.Get($"{issuerId}.{classSuffix}")
.ExecuteAsStream();
StreamReaderresponseReader=newStreamReader(responseStream);
JObjectjsonResponse=JObject.Parse(responseReader.ReadToEnd());
if(jsonResponse.ContainsKey("error"))
{
if(jsonResponse["error"].Value<int>("code")==404)
{
// Class does not exist
Console.WriteLine($"Class {issuerId}.{classSuffix} not found!");
return$"{issuerId}.{classSuffix}";
}
else
{
// Something else went wrong...
Console.WriteLine(jsonResponse.ToString());
return$"{issuerId}.{classSuffix}";
}
}
// Class exists
OfferClassupdatedClass=JsonConvert.DeserializeObject<OfferClass>(jsonResponse.ToString());
// Update the class by adding a homepage
updatedClass.HomepageUri=newGoogle.Apis.Walletobjects.v1.Data.Uri
{
UriValue="https://developers.google.com/wallet",
Description="Homepage description"
};
// Note: reviewStatus must be 'UNDER_REVIEW' or 'DRAFT' for updates
updatedClass.ReviewStatus="UNDER_REVIEW";
responseStream=service.Offerclass
.Update(updatedClass,$"{issuerId}.{classSuffix}")
.ExecuteAsStream();
responseReader=newStreamReader(responseStream);
jsonResponse=JObject.Parse(responseReader.ReadToEnd());
Console.WriteLine("Class update response");
Console.WriteLine(jsonResponse.ToString());
return$"{issuerId}.{classSuffix}";
}

Node.js

To start your integration in Node, refer to our complete code samples on GitHub.

/**
 * Update a class.
 *
 * **Warning:** This replaces all existing class attributes!
 *
 * @param {string} issuerId The issuer ID being used for this request.
 * @param {string} classSuffix Developer-defined unique ID for this pass class.
 *
 * @returns {string} The pass class ID: `${issuerId}.${classSuffix}`
 */
asyncupdateClass(issuerId,classSuffix){
letresponse;
// Check if the class exists
try{
response=awaitthis.client.offerclass.get({
resourceId:`${issuerId}.${classSuffix}`
});
}catch(err){
if(err.response && err.response.status===404){
console.log(`Class ${issuerId}.${classSuffix} not found!`);
return`${issuerId}.${classSuffix}`;
}else{
// Something else went wrong...
console.log(err);
return`${issuerId}.${classSuffix}`;
}
}
// Class exists
letupdatedClass=response.data;
// Update the class by adding a homepage
updatedClass['homepageUri']={
'uri':'https://developers.google.com/wallet',
'description':'Homepage description'
};
// Note: reviewStatus must be 'UNDER_REVIEW' or 'DRAFT' for updates
updatedClass['reviewStatus']='UNDER_REVIEW';
response=awaitthis.client.offerclass.update({
resourceId:`${issuerId}.${classSuffix}`,
requestBody:updatedClass
});
console.log('Class update response');
console.log(response);
return`${issuerId}.${classSuffix}`;
}

Update a Passes Object

Updating an individual OfferObject affects only the user who has been provisioned that specific object. You should regularly update individual offers to reflect changes that affect your customers and keep them engaged. The resourceId value would be the object ID (ISSUER_ID.OBJECT_SUFFIX).

# Update
PUT https://walletobjects.googleapis.com/walletobjects/v1/offerobject/{resourceId}
# Patch
PATCH https://walletobjects.googleapis.com/walletobjects/v1/offerobject/{resourceId}

For more information, see the API reference.

Java

To start your integration in Java, refer to our complete code samples on GitHub.

/**
 * Update an object.
 *
 * <p><strong>Warning:</strong> This replaces all existing object attributes!
 *
 * @param issuerId The issuer ID being used for this request.
 * @param objectSuffix Developer-defined unique ID for this pass object.
 * @return The pass object ID: "{issuerId}.{objectSuffix}"
 */
publicStringupdateObject(StringissuerId,StringobjectSuffix)throwsIOException{
OfferObjectupdatedObject;
// Check if the object exists
try{
updatedObject=
service.offerobject().get(String.format("%s.%s",issuerId,objectSuffix)).execute();
}catch(GoogleJsonResponseExceptionex){
if(ex.getStatusCode()==404){
// Object does not exist
System.out.printf("Object %s.%s not found!%n",issuerId,objectSuffix);
returnString.format("%s.%s",issuerId,objectSuffix);
}else{
// Something else went wrong...
ex.printStackTrace();
returnString.format("%s.%s",issuerId,objectSuffix);
}
}
// Object exists
// Update the object by adding a link
UrinewLink=
newUri()
.setUri("https://developers.google.com/wallet")
.setDescription("New link description");
if(updatedObject.getLinksModuleData()==null){
// LinksModuleData was not set on the original object
updatedObject.setLinksModuleData(newLinksModuleData().setUris(List.of(newLink)));
}else{
updatedObject.getLinksModuleData().getUris().add(newLink);
}
OfferObjectresponse=
service
.offerobject()
.update(String.format("%s.%s",issuerId,objectSuffix),updatedObject)
.execute();
System.out.println("Object update response");
System.out.println(response.toPrettyString());
returnresponse.getId();
}

PHP

To start your integration in PHP, refer to our complete code samples on GitHub.

/**
 * Update an object.
 *
 * **Warning:** This replaces all existing object attributes!
 *
 * @param string $issuerId The issuer ID being used for this request.
 * @param string $objectSuffix Developer-defined unique ID for this pass object.
 *
 * @return string The pass object ID: "{$issuerId}.{$objectSuffix}"
 */
public function updateObject(string $issuerId, string $objectSuffix)
{
 // Check if the object exists
 try {
 $updatedObject = $this->service->offerobject->get("{$issuerId}.{$objectSuffix}");
 } catch (Google\Service\Exception $ex) {
 if (!empty($ex->getErrors()) && $ex->getErrors()[0]['reason'] == 'resourceNotFound') {
 print("Object {$issuerId}.{$objectSuffix} not found!");
 return "{$issuerId}.{$objectSuffix}";
 } else {
 // Something else went wrong...
 print_r($ex);
 return "{$issuerId}.{$objectSuffix}";
 }
 }
 // Update the object by adding a link
 $newLink = new Uri([
 'uri' => 'https://developers.google.com/wallet',
 'description' => 'New link description'
 ]);
 $linksModuleData = $updatedObject->getLinksModuleData();
 if (is_null($linksModuleData)) {
 // LinksModuleData was not set on the original object
 $linksModuleData = new LinksModuleData([
 'uris' => []
 ]);
 }
 $uris = $linksModuleData->getUris();
 array_push(
 $uris,
 $newLink
 );
 $linksModuleData->setUris($uris);
 $updatedObject->setLinksModuleData($linksModuleData);
 $response = $this->service->offerobject->update("{$issuerId}.{$objectSuffix}", $updatedObject);
 print "Object update response\n";
 print_r($response);
 return $response->id;
}

Python

To start your integration in Python, refer to our complete code samples on GitHub.

defupdate_object(self, issuer_id: str, object_suffix: str) -> str:
"""Update an object.
 **Warning:** This replaces all existing object attributes!
 Args:
 issuer_id (str): The issuer ID being used for this request.
 object_suffix (str): Developer-defined unique ID for the pass object.
 Returns:
 The pass object ID: f"{issuer_id}.{object_suffix}"
 """
 # Check if the object exists
 try:
 response = self.client.offerobject().get(resourceId=f'{issuer_id}.{object_suffix}').execute()
 except HttpError as e:
 if e.status_code == 404:
 print(f'Object {issuer_id}.{object_suffix} not found!')
 return f'{issuer_id}.{object_suffix}'
 else:
 # Something else went wrong...
 print(e.error_details)
 return f'{issuer_id}.{object_suffix}'
 # Object exists
 updated_object = response
 # Update the object by adding a link
 new_link = {
 'uri': 'https://developers.google.com/wallet',
 'description': 'New link description'
 }
 if not updated_object.get('linksModuleData'):
 updated_object['linksModuleData'] = {'uris': []}
 updated_object['linksModuleData']['uris'].append(new_link)
 response = self.client.offerobject().update(
 resourceId=f'{issuer_id}.{object_suffix}',
 body=updated_object).execute()
 print('Object update response')
 print(response)
 return f'{issuer_id}.{object_suffix}'

C#

To start your integration in C#, refer to our complete code samples on GitHub.

/// <summary>
/// Update an object.
/// <para />
/// <strong>Warning:</strong> This replaces all existing class attributes!
/// </summary>
/// <param name="issuerId">The issuer ID being used for this request.</param>
/// <param name="objectSuffix">Developer-defined unique ID for this pass object.</param>
/// <returns>The pass object ID: "{issuerId}.{objectSuffix}"</returns>
publicstringUpdateObject(stringissuerId,stringobjectSuffix)
{
// Check if the object exists
StreamresponseStream=service.Offerobject
.Get($"{issuerId}.{objectSuffix}")
.ExecuteAsStream();
StreamReaderresponseReader=newStreamReader(responseStream);
JObjectjsonResponse=JObject.Parse(responseReader.ReadToEnd());
if(jsonResponse.ContainsKey("error"))
{
if(jsonResponse["error"].Value<int>("code")==404)
{
// Object does not exist
Console.WriteLine($"Object {issuerId}.{objectSuffix} not found!");
return$"{issuerId}.{objectSuffix}";
}
else
{
// Something else went wrong...
Console.WriteLine(jsonResponse.ToString());
return$"{issuerId}.{objectSuffix}";
}
}
// Object exists
OfferObjectupdatedObject=JsonConvert.DeserializeObject<OfferObject>(jsonResponse.ToString());
// Update the object by adding a link
Google.Apis.Walletobjects.v1.Data.UrinewLink=newGoogle.Apis.Walletobjects.v1.Data.Uri
{
UriValue="https://developers.google.com/wallet",
Description="New link description"
};
if(updatedObject.LinksModuleData==null)
{
// LinksModuleData was not set on the original object
updatedObject.LinksModuleData=newLinksModuleData
{
Uris=newList<Google.Apis.Walletobjects.v1.Data.Uri>()
};
}
updatedObject.LinksModuleData.Uris.Add(newLink);
responseStream=service.Offerobject
.Update(updatedObject,$"{issuerId}.{objectSuffix}")
.ExecuteAsStream();
responseReader=newStreamReader(responseStream);
jsonResponse=JObject.Parse(responseReader.ReadToEnd());
Console.WriteLine("Object update response");
Console.WriteLine(jsonResponse.ToString());
return$"{issuerId}.{objectSuffix}";
}

Node.js

To start your integration in Node, refer to our complete code samples on GitHub.

/**
 * Update an object.
 *
 * **Warning:** This replaces all existing object attributes!
 *
 * @param {string} issuerId The issuer ID being used for this request.
 * @param {string} objectSuffix Developer-defined unique ID for the pass object.
 *
 * @returns {string} The pass object ID: `${issuerId}.${objectSuffix}`
 */
asyncupdateObject(issuerId,objectSuffix){
letresponse;
// Check if the object exists
try{
response=awaitthis.client.offerobject.get({
resourceId:`${issuerId}.${objectSuffix}`
});
}catch(err){
if(err.response && err.response.status===404){
console.log(`Object ${issuerId}.${objectSuffix} not found!`);
return`${issuerId}.${objectSuffix}`;
}else{
// Something else went wrong...
console.log(err);
return`${issuerId}.${objectSuffix}`;
}
}
// Object exists
letupdatedObject=response.data;
// Update the object by adding a link
letnewLink={
'uri':'https://developers.google.com/wallet',
'description':'New link description'
}
if(updatedObject['linksModuleData']===undefined){
updatedObject['linksModuleData']={
'uris':[newLink]
};
}else{
updatedObject['linksModuleData']['uris'].push(newLink);
}
response=awaitthis.client.offerobject.update({
resourceId:`${issuerId}.${objectSuffix}`,
requestBody:updatedObject
});
console.log('Object update response');
console.log(response);
return`${issuerId}.${objectSuffix}`;
}

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026年09月01日 UTC.