This page describes the relationship between classes and objects, which is fundamental to how the Google Wallet API works. This page also covers how objects link to users.
Classes and objects
The Google Wallet API uses the concept of an object to digitally represent a single user's physical Generic 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 Google Wallet a user has in their Google Wallet app is represented
To make it easier to implement changes that need to apply to all Generic passes, every object references a class.
A class contains common data across objects. For example,
GenericClass stores the
GenericObject stores an individual's
The class and object relationship might be one-to-one, but a class can be referenced by many
Changes made to the class or object propagate immediately. Users can see these changes on the Google Wallet app when they sync.
Objects and linking
The Google Wallet API uses the concept of an
Object to represent
Generic pass. For example, an
GenericObject represents each
Generic pass a user has in their Google Wallet app.
After a user clicks the Add to Google Wallet button to add Generic pass, the
API inserts an
Object that establishes a link between the object and the user. This
means that when the user clicks the button again, a link already exists to
If a user removes their Pass from the Google Wallet app, the link to the
Object is de-linked. This means that a user can click the
Add to Google Wallet button again, to re-establish that link without a new
When you develop your Pass, we recommend that you use a new
id between adds because the API doesn't re-insert an
Object that matches an
Remember, when you remove a Pass from your account, you don't lose your
Object is only de-linked from your account, and you can link
to it again.