Google Wallet passes
Google Wallet (previously known as 'Google Pay') is a digital wallet service that can be used to store digital artifacts (known as 'passes'), such as movie tickets.
OCAPI supports generation of Google Wallet passes for completed orders that contain tickets.
Prerequisites
Ensure that the Digital Platform has been configured to enable Google Wallet. See our help centre article for details or talk to your local Vista representative for assistance.
Add to Google Wallet flow
Render an 'Add to Google Wallet' button
Google provides brand guidelines that outline the requirements for rendering an 'Add to Google Wallet' button on various platforms. The 'Add to Google Wallet' button should generate a pass when pressed and open the pass.
Generate a Google Wallet pass
Use the GetGoogleWalletPassForOrder endpoint to generate a Google Wallet pass for a completed order.
{
"jwt": "eyJhb...",
"url": "https://pay.google.com/gp/v/save/eyJhb..."
}
Points to Note
- A Google Wallet pass can only be generated for standard orders that contain tickets and have not expired.
- For orders that contain tickets to multiple showtimes, a Google Wallet pass will be generated for each showtime.
- Regardless of the number of showtimes, the endpoint will return the same JSON response.
Open the Google Wallet pass
The GetGoogleWalletPassForOrder endpoint returns the details required to open a Google Wallet pass and prompt the patron to add it to their Google Wallet.
For native Android apps, use the jwt
property along with the Google Wallet Android SDK. See Google's Issuing passes with the Android SDK guide for more info.
For web, use the url
property to navigate to the Google Wallet website or app (if installed), for example:
/**
* Loads the Google Wallet Pass and redirects the patron to Google's Add Pass to Wallet UI.
*/
async function onAddToGoogleWalletButtonClick(apiUrl, gasToken, orderId) {
const response = await fetch(
`https://${apiUrl}/ocapi/v1/orders/completed/${orderId}/assets/google-wallet-pass`,
{
method: 'GET',
headers: {
Authorization: `Bearer ${gasToken}`,
},
},
);
const googleWalletPass = await response.json();
window.open(googleWalletPass.url, '_blank');
}