Use cases

This guide outlines specific ways that you can use the Google Pay API for Passes to engage with your customers for boarding passes for the flights vertical. The API allows you to offer your customers the following options:

Update passes

If there are changes to a pass after it's created, use the REST API to deliver those changes to users. If the changes affect only classes, you can also use the Google Pay Merchant Center. Pass updates are an important way to engage with your users.

To update the fields for all of the boarding passes for a specific flight, such as when the estimated departure time changes, you only need to update or patch the FlightClass or use the Google Pay Merchant Center. Google propagates this information to all FlightObjects associated to the updated FlightClass. This is the case for all fields defined at the FlightClass level.

To update a single pass, such as when the seat number for one passenger changes, you need to update or patch a single FlightObject. This is the case for all fields defined at the FlightObject level.

Sometimes, you might not know when a change happens, or when to trigger an update or patch request. In cases like that, periodically schedule update or patch requests for each and every class and object. You can find all classes of a particular issuer account if you call the FlightClass list method. You can find all objects of a particular class if you call the FlightObject list method.

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 Pay can display data from either Google Flights or the information given in the Google Pay 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 Pay 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.

Save a flight journey with multiple legs

Often, one flight journey includes multiple legs rather than a direct journey to a person's destination. During this journey, airlines issue one boarding pass per leg of the journey. The Google Pay API for Passes mimics this behavior, with one FlightObject per leg.

This means if you have two passengers who fly from SFO to LAX to TPE, there would be two FlightClass structures and four FlightObject objects:

  FlightClass A (SFO to LAX: Carrier, flight number, departure time) FlightClass B (LAX to TPE: Carrier, flight number, departure time)
Passenger Q FlightObject: id_01 FlightObject: id_02
Passenger Z FlightObject: id_03 FlightObject: id_04

These fields reflect the physical boarding passes. Both Passenger Q and Passenger Z would have two paper boarding passes.

Make a button to save multiple passes

If a user buys multiple passes, and they're likely to save all of them to Google Pay, then it's useful to allow a user to save many objects with one click of a Save to Google Pay button or link. You can define multiple objects or classes when you sign the JSON Web Token (JWT).

You must create the JWT in either of the following formats:

  • With pre-inserted classes and objects only.
  • With only object and class resources that are fully defined within the JWT.

For an example of how to create a button for multiple passes, see Save multiple passengers button.

For more information on the UI representation of Passes, see Group multiple boarding passes.

Group multiple boarding passes

There are features which work differently if they're used on a group rather than individual objects, such as status notifications, or the organization of multiple saved Passes in the user interface.

FlightObject objects are only considered to be a group if all of the following properties are the same for each object:

  • Issuer ID (from Google Pay API for Passes Merchant Center)
  • class.flightHeader.carrier.carrierIataCode
  • class.flightHeader.flightNumber
  • class.localScheduledDepartureDateTime
  • object.reservationInfo.confirmationCode

If two FlightObject objects differ on any of the above properties, they are not considered to be grouped.

Upcoming flight notification

Google Pay sends a notification to the user three hours prior to the flight. The flight time is defined by class.localScheduledDepartureDateTime.

To receive this notification, the user must have notifications enabled. To check this, they can navigate to Settings > Notifications and see if Updates about your passes is turned on.

The notification shows up in the notifications area, and in the lock screen, if the user has notifications enabled for the lock screen

The notification has the following unmodifiable format:

Boarding pass for your flight to class.destination.airportIataCode
Expand for more options

If they tap the notification and unlock their device, their pass appears in the Google Pay app.

If the user has multiple passes, only the soonest useable pass is shown. If they've saved grouped passes as per Group multiple boarding passes, the notification only shows one of the passes in the group. However, when they tap it, the user can swipe left and right to see the other passes in that group.

The notification is pinned and won't auto-dismiss after a user opens it. Auto-dismiss occurs 60 minutes after class.localScheduledDepartureDateTime.

Receive flight update notifications

When certain fields of a flight are changed, users with one or more boarding passes saved receive a push notification on their devices. This happens only if certain conditions are met.

Origin terminal and gate

If you change class.origin.terminal or class.origin.gate, and the following condition is met, a notification is sent that the field has changed.

  • There are less than three hours to go before class.localScheduledDepartureDateTime.

The notification is in the following format: “Sample Airlines has updated your gate to A1.” The format cannot be changed.

Boarding time and departure time

If you change class.localBoardingDateTime or class.localEstimatedOrActualDepartureDateTime, and conditions below are met, a notification is sent that the field has changed.

  • There are less than 24 hours to go before class.localScheduledDepartureDateTime.
  • The respective time changes by at least 10 minutes or more.

The notification is in the following format: "Sample Airlines has updated your boarding time to 6:00PM." The format cannot be changed.

Handle expired passes

Under the "Passes" tab of the Google Pay app, there's an "Expired passes" section that contains all archived or inactive passes. A pass is moved to the "Expired passes" section if at least one of the following conditions is true:

  • It's been at least 24 hours since class.localScheduledDepartureDateTime or class.localEstimatedOrActualDepartureDateTime expired. The pass moves to "Expired passes" anytime between 24-48 hours after class.localScheduledDepartureDateTime or class.localEstimatedOrActualDepartureDateTime expires.
  • object.validTimeInterval.end.date expires. The pass moves to "Expired passes" anytime up to 24 hours after object.validTimeInterval.end.date expired.
  • The object.state field is marked as Expired, Inactive, or Completed.

Once a user has a pass saved, reference its objectId in order to link to the pass.

Use the following link to reference the pass:

https://pay.google.com/gp/v/object/{<issuerId>}.{<ObjectId>}

The pass can be viewed with the Google Pay app or a web browser.