DOM Package

Wallet Cards

Get Apple Wallet and Google Wallet card links for a signed-in customer with getWalletCardLinks()

Give signed-in customers links to add their Tiquo wallet card, such as a membership or loyalty card, to Apple Wallet or Google Wallet. First, complete the setup and sign the customer in.

Call getWalletCardLinks() with the name of a wallet card design configured in the dashboard:

const links = await tiquo.getWalletCardLinks({ designName: 'member-card' });

console.log(links.appleWalletUrl);
console.log(links.googleWalletUrl);

The design name can also be passed as a string: tiquo.getWalletCardLinks('member-card'). It must match an active wallet card design name exactly. If the account has several designs, call the method once per design name.

FieldTypeDescription
designNamestringThe design name you requested
displayNamestring | undefinedThe design's display name; omitted when the design has none
walletCardUrlstringThe general install page, where the customer picks Apple Wallet or Google Wallet
appleWalletUrlstringLinks directly to the Apple Wallet install flow
googleWalletUrlstringLinks directly to the Google Wallet install flow

The links belong to the signed-in customer. Fetch them after sign-in, and remove them from the page when the customer signs out.

Add to Wallet buttons

<a id="apple-wallet" hidden>Add to Apple Wallet</a>
<a id="google-wallet" hidden>Add to Google Wallet</a>
const appleLink = document.querySelector('#apple-wallet');
const googleLink = document.querySelector('#google-wallet');

tiquo.onAuthStateChange(async (session) => {
  if (!session) {
    appleLink.hidden = true;
    googleLink.hidden = true;
    appleLink.removeAttribute('href');
    googleLink.removeAttribute('href');
    return;
  }

  const links = await tiquo.getWalletCardLinks('member-card');
  appleLink.href = links.appleWalletUrl;
  googleLink.href = links.googleWalletUrl;
  appleLink.hidden = false;
  googleLink.hidden = false;
});

To show a single button that works on any phone, link to walletCardUrl instead.

Errors

SituationError
No customer is signed inTiquoAuthError with code NOT_AUTHENTICATED
designName is emptyGET_WALLET_CARD_LINKS_FAILED, with no statusCode
No customer profile is linked to the signed-in accountGET_WALLET_CARD_LINKS_FAILED with statusCode 403
No active design has that nameGET_WALLET_CARD_LINKS_FAILED with statusCode 404

See Utilities and Errors for handling TiquoAuthError, and Wallet Links for the Customer API endpoint this method calls.

Booking tickets

Wallet cards identify the customer. Tickets for a single booking are separate: their Apple Wallet and Google Wallet links come on each booking's ticketing object. See Booking tickets.

En esta página