Classes and objects

The Google Pay API for Passes uses the concept of an object to digitally represent a single user's physical loyalty cards, gift cards, offers, event tickets, boarding passes for flights, and transit passes. The API uses the concept of a class to allow management of data common across all users. To cover specific use cases, each vertical has its own respective object and class.

For example, each loyalty card a user has in their Google Pay app is represented by one LoyaltyObject, which references a LoyaltyClass. Similarly, each gift card in a user’s Google Pay app is represented by one GiftCardObject, which references a GiftCardClass.

Each object references a class so that it's easier to make changes that should be applied to all loyalty cards, gift cards, offers, event tickets, boarding passes for flights, and transit passes.

A class contains common data across objects. For example, LoyaltyClass stores the programName, while LoyaltyObject stores an individual’s accountId. The class and object relationship can be one-to-one, but it isn't necessarily so. A class can be referenced by many objects.

Changes made to the class or object are propagated immediately. Users can see these changes on the Google Pay app when they sync.

Send feedback about...

Google Pay for Passes