Make a button to save multiple passes

Stay organized with collections Save and categorize content based on your preferences.

If a user buys multiple passes, and they're likely to add all of them to Google Wallet, then it's useful to allow a user to add many objects with one click of a Add to Google Wallet 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.

You can save many passes with one Add to Google Wallet button or weblink, which is useful when one user purchases multiple tickets for one event.

In order to save multiple attendees, include multiple Passes in the array in the JSON Web Token (JWT) to be signed. The following examples show two variations on how to do this:

  1. This example uses pre-inserted event ticket classes and objects categorized as the same group, and it only sends the IDs of each object. Note that the classId property is optional. It's shown here for demonstrative purposes. In this example, the class IDs used are different.

    {
        "aud": "google",
        "origins": [
            "http://localhost:8080"
        ],
        "iss": "your_iam_account@appspot.gserviceaccount.com",
        "iat": 1536970285,
        "typ": "savetoandroidpay",
        "payload": {
            "eventTicketObjects": [
                {
                    "classId": "<my_issuer_id>.EventTicketClass_A",
                    "id": "<my_issuer_id>.EventTicketObject_A"
                },
                {
                    //this is a different class, but has same class.eventId
                    "classId": "<my_issuer_id>.EventTicketClass_B",
                    "id": "<my_issuer_id>.EventTicketObject_B"
                }
            ]
        }
    }
  2. This example defines a class, as well as multiple objects that reference this class. Both the class and the objects are inserted when the user saves the passes.

    {
        "aud": "google",
        "origins": [
            "http://localhost:8080"
        ],
        "iss": "your_iam_account@appspot.gserviceaccount.com",
        "iat": 1536970285,
        "typ": "savetoandroidpay",
        "payload": {
            "eventTicketClasses": [
              {
               "id": "<my_issuer_id>.EventTicketClass",
               "issuerName": "Baconrista Events",
               "reviewStatus": "underReview",
               "eventName": {
                "defaultValue": {
                 "language": "en-US",
                 "value": "Bacon Coffee Fun Event"
                }
               },
               "venue": {
                "name": {
                 "defaultValue": {
                  "language": "En-US",
                  "value": "1600 Amphitheatre Pkwy, Mountain View, CA 94043"
                 }
                },
                "address": {
                 "defaultValue": {
                  "language": "En-US",
                  "value": "1600 Amphitheatre Pkwy, Mountain View, CA 94043"
                 }
                }
               },
               "dateTime": {
                "doorsOpenLabel": "doorsOpen",
                "doorsOpen": "2027-04-12T19:20",
                "start": "2027-04-12T20:00",
                "end": "2027-04-12T21:20"
               }
              }
          ],
          "eventTicketObjects": [ {
            "classId": "<my_issuer_id>.EventTicketClass",
            "id": "<my_issuer_id>.EventTicketObject_1",
            "state": "active",
            },
            {
              "classId": "<my_issuer_id>.EventTicketClass",
              "id": "<my_issuer_id>.EventTicketObject_1",
              "state": "active",
            }
          ]
        }
    }

For more information on the UI representation of multiple passes, see Group multiple event tickets.