Save to Google Pay

Let your users save a pass to Google Pay from a website or email at the click of a button.

Airship provides an API function that returns JavaScript to render the Save to Google Pay button with the necessary information to create a wallet object. All you need is the user information and any pass-specific details.

  • When the Save to Google Pay button is rendered on the page, a user can hover over it to display the currently logged in account, with an option to change to a different account. If not logged in, a log in window appears.

  • After clicking the button while logged in with a valid Google account, the Google Object will be created and saved to the user's wallet. Depending on how you configure the onSuccess JSON value, you can redirect to a different page or simply do nothing, and the Google JavaScript library will let the user know the card was successfully saved.

 Note

Pass creation via the API is the preferred method due to ease of use and implementation, but in some cases you may want to use the Save to Google Pay method.

  1. Define the Origin URL:
    1. Open your mobile wallet project and go to Settings » API.
    2. Click Edit next to Save to Google Pay.
    3. Enter the root URL where you want to place your Save to Google Pay button, e.g., https://www.mysite.com.
       Note

      The Origin URL is a list of domains to whitelist JSON Web Token (JWT) saving functionality. The Save to Google Pay button will not render if this field is not filled out properly.

    4. Click Save.
  2. Generate the JavaScript by making a POST call that generates the JavaScript you will use with Google's integration instructions: POST /v1/pass/{templateID}/saveToWallet, with the template ID matching the template ID in your mobile wallet project. See Wallet API: Save to Google Pay for full documentation.
  3. Follow the instructions provided by Google to Add the Save to Google Pay button, including the JavaScript generated from the POST call.

Save to Google Pay From Email

Save your users a click by adding a deep link to a pass from a Save to Google Pay button in an email and from the subject line in Gmail.

Since the format of a Google Pay pass URL is already a deep link, just use that URL in a Save to Google Pay button in an email or email subject line. Follow the instructions provided by Google: Add the Save to Google Pay button to your email.