Skip to main content

Integrate the Google Wallet API: classes, objects and JWT

On Android, a pass is not a file: it is an object hosted by Google, attached to a class. Your server creates them through the Google Wallet API, then gives the customer an "Add to Google Wallet" link. This guide covers what that involves, and what eldo wallet does for you.

Classes and objects​

ConceptRoleExample
ClassThe shared template: program, logo, colors, textsYour brand's loyalty program
ObjectOne holder's copy: their ID, balance and barcodeMarie's card, 320 points

Each pass type has its pair: LoyaltyClass / LoyaltyObject for loyalty, OfferClass / OfferObject for coupons, EventTicketClass for tickets, TransitClass and FlightClass for travel, GenericClass for the rest. IDs take the form ISSUER_ID.suffix.

Doing it yourself: the steps​

  1. Create an issuer account in the Google Pay & Wallet Console and note the issuer ID.
  2. Create a Google Cloud project, enable the Google Wallet API and create a service account with its key.
  3. Authorize that service account in the issuer console.
  4. Create the class (for example a LoyaltyClass) through the REST API.
  5. Create one object per holder, attached to the class.
  6. Generate the add link: a JWT signed with the service account key, appended to https://pay.google.com/gp/v/save/.
  7. Request production access: until Google approves it, only test accounts can add your passes.

Keeping passes up to date​

  • To change a balance or a time, update the object: Google pushes the new version to the phone.
  • To notify the holder, add a message to the object or the class.
  • To change the design, update the class: every object follows.

And all of that for Android only: the iPhone needs a signed .pkpass file, see Generate a pkpass file.

With eldo wallet​

eldo wallet publishes the Google Wallet classes and objects, signs the links and relays every update, together with the Apple Wallet version. Everything goes through the eldo wallet issuer account: no Google Wallet account to open (large accounts can use their own). See Apple Wallet vs Google Wallet.

Doing it yourselfWith the eldo wallet API
Open a Google Wallet issuer account and a service accountNot needed: eldo wallet issues with its own account
Create the LoyaltyClassSet up the card once: PATCH/store-cards
Create one LoyaltyObject per holderCreate the customer: POST/clients
Sign a JWT for each add linkOne link (shortLink) for Google Wallet and Apple Wallet
Update the object, add a messagePATCH/clients/{id}/gain, POST/push-notifications
Create an OfferClass for couponsPOST/coupons

To get started: the quickstart creates a loyalty card and sends it to a customer in three calls.

Learn more​

API news, once a month

New endpoints, upcoming changes, guides and use cases. No spam, one-click unsubscribe.

Report a technical problem

An API error, a pass that does not update, an email that does not arrive? Describe the problem: our technical team will answer.

For a fast answer, include:

  • The method and endpoint (e.g. POST /clients)
  • The error code returned (errorCode) and the body sent
  • The date and time of the call
  • The identifiers involved (customer, template, pass)

Never include an API token or a password.

AI assistant

Beta

Loading…

AI-generated answers (Claude): double-check important details.

Sign in to use the assistant