Update Passes Classes and Passes Objects  |  Boarding passes  |  Google for Developers (2024)

  • Home
  • Products
  • Google Wallet
  • Boarding passes
Stay organized with collections Save and categorize content based on your preferences.

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

There are two resources that can be updated: The FlightClass and theFlightObject.

Best Practices

The following list contains helpful information to consider when updating yourBoarding Pass 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, senda 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 toensure you are working with the latest version and all of the intendedfields are included in your request.
  • When making a patch request, only the patched fields areupdated. Before sending a patch request, consider optionally sending aGET request to compare your changes against the latest version.
  • When making patch requests to update arrays, the original array isreplaced with the one included in the request body. You cannot modify theelements in an array individually.
  • In some cases, you may not know when changes happen, or when to triggerupdates. Consider periodically scheduling update or patch requests forall classes and objects.

Update a Passes Class

Use the Google Wallet Business Console

Pass classes (not objects) can be modified directly in theGoogle 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 anyflight holders.

Use the Google Wallet API

Updating the FlightClass affects all users who have been provisionedBoarding Passes using this class. For example, to update the logo foryour Boarding Passes, you would submit an update or patch request tothe Google Wallet API at either of the following endpoints. The resourceIdvalue would be the class ID (ISSUER_ID.CLASS_SUFFIX).

# UpdatePUT https://walletobjects.googleapis.com/walletobjects/v1/flightclass/{resourceId}# PatchPATCH https://walletobjects.googleapis.com/walletobjects/v1/flightclass/{resourceId}

For more information, see theAPI 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}" */public String updateClass(String issuerId, String classSuffix) throws IOException { FlightClass updatedClass; // Check if the class exists try { updatedClass = service.flightclass().get(String.format("%s.%s", issuerId, classSuffix)).execute(); } catch (GoogleJsonResponseException ex) { if (ex.getStatusCode() == 404) { // Class does not exist System.out.printf("Class %s.%s not found!%n", issuerId, classSuffix); return String.format("%s.%s", issuerId, classSuffix); } else { // Something else went wrong... ex.printStackTrace(); return String.format("%s.%s", issuerId, classSuffix); } } // Class exists // Update the class by adding a homepage updatedClass.setHomepageUri( new Uri() .setUri("https://developers.google.com/wallet") .setDescription("Homepage description")); // Note: reviewStatus must be 'UNDER_REVIEW' or 'DRAFT' for updates updatedClass.setReviewStatus("UNDER_REVIEW"); FlightClass response = service .flightclass() .update(String.format("%s.%s", issuerId, classSuffix), updatedClass) .execute(); System.out.println("Class update response"); System.out.println(response.toPrettyString()); return response.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->flightclass->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->flightclass->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.

def update_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.flightclass().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.flightclass().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>public string UpdateClass(string issuerId, string classSuffix){ // Check if the class exists Stream responseStream = service.Flightclass .Get($"{issuerId}.{classSuffix}") .ExecuteAsStream(); StreamReader responseReader = new StreamReader(responseStream); JObject jsonResponse = 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 FlightClass updatedClass = JsonConvert.DeserializeObject<FlightClass>(jsonResponse.ToString()); // Update the class by adding a homepage updatedClass.HomepageUri = new Google.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.Flightclass .Update(updatedClass, $"{issuerId}.{classSuffix}") .ExecuteAsStream(); responseReader = new StreamReader(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}` */async updateClass(issuerId, classSuffix) { let response; // Check if the class exists try { response = await this.client.flightclass.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 let updatedClass = 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 = await this.client.flightclass.update({ resourceId: `${issuerId}.${classSuffix}`, requestBody: updatedClass }); console.log('Class update response'); console.log(response); return `${issuerId}.${classSuffix}`;}

Update a Passes Object

Updating an individual FlightObject affects only the user who has beenprovisioned that specific object. You should regularly update individualBoarding Passes to reflect changes that affect your customers and keepthem engaged. The resourceId value would be the object ID(ISSUER_ID.OBJECT_SUFFIX).

# UpdatePUT https://walletobjects.googleapis.com/walletobjects/v1/flightobject/{resourceId}# PatchPATCH https://walletobjects.googleapis.com/walletobjects/v1/flightobject/{resourceId}

For more information, see theAPI 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}" */public String updateObject(String issuerId, String objectSuffix) throws IOException { FlightObject updatedObject; // Check if the object exists try { updatedObject = service.flightobject().get(String.format("%s.%s", issuerId, objectSuffix)).execute(); } catch (GoogleJsonResponseException ex) { if (ex.getStatusCode() == 404) { // Object does not exist System.out.printf("Object %s.%s not found!%n", issuerId, objectSuffix); return String.format("%s.%s", issuerId, objectSuffix); } else { // Something else went wrong... ex.printStackTrace(); return String.format("%s.%s", issuerId, objectSuffix); } } // Object exists // Update the object by adding a link Uri newLink = new Uri() .setUri("https://developers.google.com/wallet") .setDescription("New link description"); if (updatedObject.getLinksModuleData() == null) { // LinksModuleData was not set on the original object updatedObject.setLinksModuleData(new LinksModuleData().setUris(List.of(newLink))); } else { updatedObject.getLinksModuleData().getUris().add(newLink); } FlightObject response = service .flightobject() .update(String.format("%s.%s", issuerId, objectSuffix), updatedObject) .execute(); System.out.println("Object update response"); System.out.println(response.toPrettyString()); return response.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->flightobject->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->flightobject->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.

def update_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.flightobject().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.flightobject().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>public string UpdateObject(string issuerId, string objectSuffix){ // Check if the object exists Stream responseStream = service.Flightobject .Get($"{issuerId}.{objectSuffix}") .ExecuteAsStream(); StreamReader responseReader = new StreamReader(responseStream); JObject jsonResponse = 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 FlightObject updatedObject = JsonConvert.DeserializeObject<FlightObject>(jsonResponse.ToString()); // Update the object by adding a link Google.Apis.Walletobjects.v1.Data.Uri newLink = new Google.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 = new LinksModuleData { Uris = new List<Google.Apis.Walletobjects.v1.Data.Uri>() }; } updatedObject.LinksModuleData.Uris.Add(newLink); responseStream = service.Flightobject .Update(updatedObject, $"{issuerId}.{objectSuffix}") .ExecuteAsStream(); responseReader = new StreamReader(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}` */async updateObject(issuerId, objectSuffix) { let response; // Check if the object exists try { response = await this.client.flightobject.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 let updatedObject = response.data; // Update the object by adding a link let newLink = { '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 = await this.client.flightobject.update({ resourceId: `${issuerId}.${objectSuffix}`, requestBody: updatedObject }); console.log('Object update response'); console.log(response); return `${issuerId}.${objectSuffix}`;}

Data sources for flight updates

If the time given by class.localScheduledDepartureDateTime was in the past 24 hours or is in the next 48 hours, a flight status card appears to users. When this happens, Google Wallet can display data from either Google Flights or the information given in the Google Wallet pass. Which source is used depends on the following:

  • If class.localEstimatedOrActualDepartureDateTime is not provided, then Google Flights is used. In this case, any class.flightStatus you set is ignored.

    For instance, if a flight is delayed, users see a card under the "Home" tab of the Google Wallet app that displays the new departure time. A similar delay card also surfaces to users under the "Passes" tab.

  • If you've provided the class.localEstimatedOrActualDepartureDateTime but not class.flightStatus, the provided time is used to determine if a flight is delayed. The flight status on the card is then surfaced to users based on the following logic:
    • If class.localEstimatedOrActualDepartureDateTime is greater than class.localScheduledDepartureDateTime, show users a card with the flight listed as delayed.
    • If class.localEstimatedOrActualDepartureDateTime is not greater than class.localScheduledDepartureDateTime, show users the card with the flight information but without any status message.

If you don't want to use Google Flights as a source of information about flights, be sure to provide the flightStatus, localScheduledDepartureDateTime, and localEstimatedOrActualDepartureDateTime of a FlightClass. Only your data is used on the card. Alternatively, if you use an ICAO carrier code instead of an IATA code in FlightClass, Google Flights is not used as a source of flight information.

When certain fields are changed, the user receives push notifications about the changes. For more details, see Receive flight update notifications.

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 2024-09-13 UTC.

Update Passes Classes and Passes Objects  |  Boarding passes  |  Google for Developers (2024)
Top Articles
What Is Impulse Buying? 5 Ways to Resist - NerdWallet
7 Cheapest Places to Live in West Virginia in 2024
Frederick County Craigslist
Beacon Schnider
Robinhood Turbotax Discount 2023
Pitt Authorized User
35105N Sap 5 50 W Nit
Arrests reported by Yuba County Sheriff
Cosentyx® 75 mg Injektionslösung in einer Fertigspritze - PatientenInfo-Service
Decaying Brackenhide Blanket
Atrium Shift Select
Pbr Wisconsin Baseball
Heska Ulite
Brenna Percy Reddit
Raid Guides - Hardstuck
Edible Arrangements Keller
Nj State Police Private Detective Unit
Les Rainwater Auto Sales
Illinois VIN Check and Lookup
Drago Funeral Home & Cremation Services Obituaries
Ubg98.Github.io Unblocked
Persona 5 Royal Fusion Calculator (Fusion list with guide)
Self-Service ATMs: Accessibility, Limits, & Features
Universal Stone Llc - Slab Warehouse & Fabrication
Laveen Modern Dentistry And Orthodontics Laveen Village Az
1973 Coupe Comparo: HQ GTS 350 + XA Falcon GT + VH Charger E55 + Leyland Force 7V
The EyeDoctors Optometrists, 1835 NW Topeka Blvd, Topeka, KS 66608, US - MapQuest
Play Tetris Mind Bender
Webworx Call Management
Cornedbeefapproved
Cor Triatriatum: Background, Pathophysiology, Epidemiology
Vera Bradley Factory Outlet Sunbury Products
Is Henry Dicarlo Leaving Ktla
2004 Honda Odyssey Firing Order
Taylored Services Hardeeville Sc
Marlene2295
Ridge Culver Wegmans Pharmacy
Landing Page Winn Dixie
The Ultimate Guide to Obtaining Bark in Conan Exiles: Tips and Tricks for the Best Results
Cbs Trade Value Chart Week 10
Stolen Touches Neva Altaj Read Online Free
Lowell Car Accident Lawyer Kiley Law Group
Amici Pizza Los Alamitos
Hair Love Salon Bradley Beach
AP Microeconomics Score Calculator for 2023
Raisya Crow on LinkedIn: Breckie Hill Shower Video viral Cucumber Leaks VIDEO Click to watch full…
Mid America Irish Dance Voy
Online-Reservierungen - Booqable Vermietungssoftware
Backpage New York | massage in New York, New York
Yosemite Sam Hood Ornament
Minecraft Enchantment Calculator - calculattor.com
Stone Eater Bike Park
Latest Posts
Article information

Author: Rob Wisoky

Last Updated:

Views: 6818

Rating: 4.8 / 5 (48 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Rob Wisoky

Birthday: 1994-09-30

Address: 5789 Michel Vista, West Domenic, OR 80464-9452

Phone: +97313824072371

Job: Education Orchestrator

Hobby: Lockpicking, Crocheting, Baton twirling, Video gaming, Jogging, Whittling, Model building

Introduction: My name is Rob Wisoky, I am a smiling, helpful, encouraging, zealous, energetic, faithful, fantastic person who loves writing and wants to share my knowledge and understanding with you.