--- title: "Google Pay express checkout" description: "Configure Google Pay for express checkout." url: "https://docs.adyen.com/payment-methods/google-pay/web-component/express-checkout" source_url: "https://docs.adyen.com/payment-methods/google-pay/web-component/express-checkout.md" canonical: "https://docs.adyen.com/payment-methods/google-pay/web-component/express-checkout" last_modified: "2025-11-06T11:53:00+01:00" language: "en" --- # Google Pay express checkout Configure Google Pay for express checkout. [View source](/payment-methods/google-pay/web-component/express-checkout.md) Google Pay is an express payment method that lets shoppers pay with fewer steps. ## Requirements | Requirement | Description | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **Integration type** | Google Pay express checkout is supported only with the Advanced flow integration. Make sure that you have built an [Advanced flow Components integration](/online-payments/build-your-integration/advanced-flow?platform=Web\&integration=Components). | | **Limitations** | Google Pay express checkout is not supported on Android. | | **Setup steps** | Before you begin:- Follow the [setup steps in the Google Pay documentation](https://developers.google.com/pay/api/web/guides/setup). - [Add Google Pay in your Customer Area](/payment-methods/add-payment-methods).. | ## Code samples ** ### HTML **DOM element** ```html
``` ** ### JavaScript **Component implementation example** ```js const googlePay = new GooglePay('googlepay', { // Step 2: Set the callback intents. callbackIntents: ['SHIPPING_ADDRESS', 'SHIPPING_OPTION'], // Step 3: Set shipping configurations. shippingAddressRequired: true, shippingAddressParameters: { allowedCountryCodes: [], phoneNumberRequired: true }, // Shipping options configurations. shippingOptionRequired: true, // Step 4: Pass the default shipping options. shippingOptions: { defaultSelectedOptionId: 'shipping-001', shippingOptions: [ { id: 'shipping-001', label: '$0.00: Free shipping', description: 'Free shipping: delivered in 10 business days.' }, { id: 'shipping-002', label: '$1.99: Standard shipping', description: 'Standard shipping: delivered in 3 business days.' }, ] }, // Step 5: Set the transaction information. //Required for v6.0.0 or later. isExpress: true, // Line items. transactionInfo:{ displayItems: [ { label: 'Subtotal', type: 'SUBTOTAL', price: '99.00' }, { label: 'Tax', type: 'TAX', price: '1.00' } ], countryCode: 'US', currencyCode: 'USD', totalPriceStatus: 'FINAL', totalPrice: '100.00', totalPriceLabel: 'Total' }, // Step 6: (Optional) Add additional configuration. // Configuration from Google Pay documentation: https://developers.google.com/pay/api/web/reference/request-objects. emailRequired: true, billingAddressRequired: true, billingAddressParameters: { format: 'FULL' }, // Step 7: Update the payment data. paymentDataCallbacks: { onPaymentDataChanged(intermediatePaymentData) { return new Promise(async resolve => { const { callbackTrigger, shippingAddress, shippingOptionData } = intermediatePaymentData; const paymentDataRequestUpdate = {}; // Validate the country/region and address selection. if (shippingAddress.countryCode !== 'US' && shippingAddress.countryCode !== 'BR') { paymentDataRequestUpdate.error = { reason: 'SHIPPING_ADDRESS_UNSERVICEABLE', message: 'Cannot ship to the selected address', intent: 'SHIPPING_ADDRESS' }; } // If it initializes or changes the shipping address, calculate the shipping options and transaction info. if (callbackTrigger === 'INITIALIZE' || callbackTrigger === 'SHIPPING_ADDRESS') { paymentDataRequestUpdate.newShippingOptionParameters = await fetchNewShippingOptions(shippingAddress.countryCode); paymentDataRequestUpdate.newTransactionInfo = calculateNewTransactionInfo(/* ... */); } // If SHIPPING_OPTION changes, calculate the new shipping amount. if (callbackTrigger === 'SHIPPING_OPTION') { paymentDataRequestUpdate.newTransactionInfo = calculateNewTransactionInfo(/* ... */); } resolve(paymentDataRequestUpdate); }); } }, // Step 8: Configure the callback to get the shopper's information. onAuthorized: paymentData => { console.log('Shopper details', paymentData); } }); // Step 9: Mount the Component. googlepay .isAvailable() .then(() => { googlePay.mount("#googlepay-container"); }) .catch(e => { // Google Pay isn't available. }); ``` For more details about each step, continue to the step-by-step guide below. ## Step 1: Create a DOM element Create a [Document Object Model (DOM)](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model) element where you want to implement express checkout. **Create a DOM element** ```html ``` ## Step 2: Set the callback intents When you create an instance of the Component, set the [callback intents](https://developers.google.com/pay/api/web/reference/request-objects#PaymentDataRequest) from Google Pay: **Callback intents** ```js const googlePay = new GooglePay('googlepay', { callbackIntents: ['SHIPPING_ADDRESS', 'SHIPPING_OPTION'], // ...Other parameters. }); ``` ## Step 3: Set shipping configurations Configure the options for [shipping address and shipping options](https://developers.google.com/pay/api/web/reference/request-objects#PaymentDataRequest): **Shipping configuration** ```js const googlePay = new GooglePlay('googlepay', { // ...Other parameters. // Shipping address configurations. shippingAddressRequired: true, shippingAddressParameters: { allowedCountryCodes: [], phoneNumberRequired: true }, // Shipping options configurations. shippingOptionRequired: true }); ``` ## Step 4: Pass the default shipping options Configure the default [shipping option parameters](https://developers.google.com/pay/api/web/reference/request-objects#ShippingOptionParameters). **Default shipping options** ```js const googlePay = new GooglePay('googlepay', { // ...Other parameters shippingOptionParameters: { defaultSelectedOptionId: 'shipping-001', shippingOptions: [ { id: 'shipping-001', label: '$0.00: Free shipping', description: 'Free shipping: delivered in 10 business days.' }, { id: 'shipping-002', label: '$1.99: Standard shipping', description: 'Standard shipping: delivered in 3 business days.' }, ] } }); ``` ## Step 5: Set the transaction information Set up additional [component configuration](/payment-methods/google-pay/web-component#transaction-info), and set the initial [transaction information](https://developers.google.com/pay/api/web/reference/request-objects#TransactionInfo). For example: For v6.0.0 or later, you must include `isExpress`: **true**. **Get transaction information** ```js const googlePay = new GooglePay('googlepay', { //... Other parameters. // Required for v6.0.0 or later. isExpress: true, transactionInfo:{ displayItems: [ { label: 'Subtotal', type: 'SUBTOTAL', price: '99.00' }, { label: 'Tax', type: 'TAX', price: '1.00' } ], countryCode: 'US', currencyCode: 'USD', totalPriceStatus: 'FINAL', totalPrice: '100.00', totalPriceLabel: 'Total' } }); ``` ## Step 6: (Optional) Add additional configuration In your configuration object, you can include additional configuration supported by the [Google Pay request object](https://developers.google.com/pay/api/web/reference/request-objects). For example, to require the shopper's email and full billing address at checkout, include the following configuration: | Configuration | Description | | -------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | | [`emailRequired`](https://developers.google.com/pay/api/web/reference/request-objects#PaymentDataRequest) | Set to **true** to require the shopper to enter their email address. | | [`billingAddressRequired`](https://developers.google.com/pay/api/web/reference/request-objects#CardParameters) | Set to **true** to require the shopper to enter their billing address. | | [`billingAddressParameters`](https://developers.google.com/pay/api/web/reference/request-objects#BillingAddressParameters) | Set which billing address fields to include. | **Add additional configuration** ```js const googlePay = new GooglePay('googlepay', { //... Other parameters. // Set to true to require the shopper to enter their email address. emailRequired: true, // Set to true to require the shopper to enter their billing address. billingAddressRequired: true, // Set the billing address to include all fields. billingAddressParameters: { format: 'FULL' } }); ``` ## Step 7: Update the payment data Implement the [callback](https://developers.google.com/pay/api/web/reference/client#onPaymentDataChanged) to get [updated payment data](https://developers.google.com/pay/api/web/reference/request-objects#PaymentDataRequestUpdate) from Google Pay, like if the shipping address changes. You must come up with the logic to get the new shipping options and calculate the new total. You can do this by implementing your own functions like `fetchNewShippingOptions` and `calculateNewTransactionInfo`. For example: **Get updated payment data from Google Pay** ```js const googlePay = new GooglePay('googlepay', { //... Other parameters. paymentDataCallbacks: { onPaymentDataChanged(intermediatePaymentData) { return new Promise(async resolve => { const { callbackTrigger, shippingAddress, shippingOptionData } = intermediatePaymentData; const paymentDataRequestUpdate = {}; // Validate the country/region and address selection. if (shippingAddress.countryCode !== 'US' && shippingAddress.countryCode !== 'BR') { paymentDataRequestUpdate.error = { reason: 'SHIPPING_ADDRESS_UNSERVICEABLE', message: 'Cannot ship to the selected address', intent: 'SHIPPING_ADDRESS' }; } // If it initializes or changes the shipping address, calculate the shipping options and transaction info. if (callbackTrigger === 'INITIALIZE' || callbackTrigger === 'SHIPPING_ADDRESS') { paymentDataRequestUpdate.newShippingOptionParameters = await fetchNewShippingOptions(shippingAddress.countryCode); paymentDataRequestUpdate.newTransactionInfo = calculateNewTransactionInfo(/* ... */); // You must implement this function and its logic. } // If SHIPPING_OPTION changes, calculate the new shipping amount. if (callbackTrigger === 'SHIPPING_OPTION') { paymentDataRequestUpdate.newTransactionInfo = calculateNewTransactionInfo(/* ... */); // You must implement this function and its logic. } resolve(paymentDataRequestUpdate); }); } } }); ``` When the payment amount changes, Adyen doesn't receive the updated amount from Google Pay. You must validate that the updated amount is correct before you send it in the [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request. If the amount changes, update the amount and pass it to [`onSubmit` ](/online-payments/build-your-integration/advanced-flow/?platform=Web\&integration=Components#adyencheckout)to make the [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request. ## Step 8: Configure the callback to get the shopper's information Implement the event handler to get the shopper's [information from Google Pay](https://developers.google.com/pay/api/web/reference/response-objects#PaymentData). This is triggered before `onSubmit`: **Get the shopper information from Google Pay payment data** ```js const googlePay = new GooglePay('googlepay', { // ...Other parameters onAuthorized: paymentData => { console.log('Shopper details', paymentData); } }); ``` When the shopper checks out with Google Pay as an express payment method, the configurations you implemented give you updates on the shipping address, payment data, and shopper information. ## Step 9: Mount the Component Check that Google Pay is available and mount the Component: **Check if available and mount the Component** ```js googlepay .isAvailable() .then(() => { googlePay.mount("#googlepay-container"); }) .catch(e => { // Google Pay isn't available. }); ``` ## See also * [Web Components integration guide](/online-payments/components-web) * [Google Pay API](https://developers.google.com/pay/api/) * [Tokenization](/online-payments/tokenization) * [Google Pay error codes](/development-resources/error-codes#google-pay-error-codes) * [API Explorer](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/overview)