---
title: "Google Pay Drop-in integration"
description: "Add Google Pay to an existing Drop-in integration."
url: "https://docs.adyen.com/payment-methods/google-pay/web-drop-in"
source_url: "https://docs.adyen.com/payment-methods/google-pay/web-drop-in.md"
canonical: "https://docs.adyen.com/payment-methods/google-pay/web-drop-in"
last_modified: "2023-11-06T15:28:00+01:00"
language: "en"
---

# Google Pay Drop-in integration

Add Google Pay to an existing Drop-in integration.

[View source](/payment-methods/google-pay/web-drop-in.md)

This page explains how to add Google Pay to your existing Web Drop-in integration.

When shoppers select Google Pay, Drop-in presents the Google Pay payment sheet where shoppers choose a card they want to use. If shoppers select a card that requires 3D Secure authentication, Drop-in also handles redirecting shoppers to another website to complete the verification.

## Requirements

| Requirement          | Description                                                                                                                                                                                                           |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Integration type** | Make sure that you have built your [Drop-in integration](/online-payments/build-your-integration/sessions-flow?platform=Web\&integration=Drop-in).                                                                    |
| **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).. |

## API reference

You do not need to send additional fields for Google Pay. To see optional fields that you can send for all payment methods, choose the endpoint you integrated:

* [/sessions](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions): This is the default with [Drop-in v5.0.0](/online-payments/build-your-integration/sessions-flow?platform=Web\&integration=Drop-in) or later.
* [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments): If you implemented an [additional use case](/online-payments/build-your-integration).

## Drop-in configuration

### Load the Google Pay API JavaScript library

We recommend that you preload the Google Pay API JavaScript library, by including the\
following script in your checkout page:

```js
<script src="https://pay.google.com/gp/p/js/pay.js"></script>
```

If you are loading the Drop-in inside an [iframe element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe), add the [`allow` attribute to the iframe](https://www.w3.org/TR/payment-request/#using-with-cross-origin-iframes) to render Google Pay. For example:

```js
<iframe allow="payment">
</iframe>
```

### Required configuration

Select which endpoint you are using:

### Tab: `/sessions`

This is the default with [Drop-in v5.0.0](/online-payments/build-your-integration/sessions-flow?platform=Web\&integration=Drop-in) or later.

There's no additional configuration you need to include for Google Pay.

### Tab: `/payments`

If you implemented an [additional use case](/online-payments/build-your-integration).

| Parameter name                                        | Required                                                                                    | Description                                                                                                                                 |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `amount.value`                                        | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The value of the payment, in [minor units](/development-resources/currency-codes).                                                          |
| `amount.currency`                                     | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The [currency code](/development-resources/currency-codes) of the payment.                                                                  |
| `countryCode`                                         | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The two-letter country code of your merchant account.                                                                                       |
| `environment`                                         | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Set to **production** when you are ready to accept live payments. The default value is **test**.                                            |
| `authenticationData.threeDSRequestData.nativeThreeDS` |                                                                                             | Only required when native 3DS2 applies. Set to **preferred**.                                                                               |
| `origin`                                              |                                                                                             | Only required when native 3DS2 applies. Set this parameter to the origin URL of the page that you are loading the 3D Secure Component from. |

The following example shows how to configure Drop-in:

**Google Pay configuration**

```js
const googlePayConfiguration = {
    amount: {
        value: 1000,
        currency: "EUR"
    },
    countryCode: "NL",
    //Set this to production when you are ready to accept live payments
    environment: "test"
};
```

Include the `googlePayConfiguration` object when [creating a configuration object](/online-payments/build-your-integration/sessions-flow?platform=Web\&integration=Drop-in#configure):

**AdyenCheckout configuration**

```js
const configuration = {
  // ...  other required configuration
  paymentMethodsConfiguration: {
    googlepay: googlePayConfiguration
  }
};
```

Pass the Drop-in configuration object when creating your instance of `AdyenCheckout`:

```js
const checkout = await AdyenCheckout(configuration);
```

### Optional configuration

This [optional configuration parameter](/online-payments/build-your-integration/sessions-flow/?platform=Web\&integration=Drop-in) is only accepted on the `dropin` instance.

#### Instant payment button configuration

Use the `instantPaymentTypes` object to display the Google Pay payment button at the top of the list of available payment methods. The sample below shows how to do this:

**Optional Drop-in instance configuration**

```js
const dropin = checkout.create('dropin', {
    // ... other optional configuration
    // For v5.30.0 or later: you can also use the value googlepay.
    instantPaymentTypes: ['googlepay']
}).mount('#dropin-container');
```

### Optional Google Pay configuration

You can configure the following:

* [Merchant info](#merchant-info)
* [Button options](#button-options)
* [Payment data](#payment-data)
* [Card parameters](#card-parameters)
* [Payment method support](#payment-method-support)
* [Transaction info](#transaction-info)
* [Events](#events)

#### Merchant info

Configure the merchant name rendered in the payment sheet. See [MerchantInfo](https://developers.google.com/pay/api/web/reference/request-objects#MerchantInfo) for more details.

Values you set in the `configuration` object will override any Google Pay configuration from your back end.

| Property                          | Description                                                                                                                                                                                                                                                                                                                          |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `configuration.merchantName`      | The merchant name you want displayed in the payment sheet. If specified, you must also specify `configuration.merchantId` and `configuration.gatewayMerchantId`.                                                                                                                                                                     |
| `configuration.gatewayMerchantId` | The name of your Adyen merchant or company account. Required if `merchantName` is specified.                                                                                                                                                                                                                                         |
| `configuration.merchantId`        | Your [Google Merchant ID](https://developers.google.com/pay/api/web/reference/request-objects#MerchantInfo). Required if `merchantName` is specified. The `merchantId` can be anything for testing. Before you go live, get your Google Merchant ID from the [Google Pay & Wallet Console](https://pay.google.com/business/console). |
| `configuration.authJwt`           | Your signed JSON Web Token (JWT). This allows you to use your Google merchant ID with multiple domains. If specified, you must also provide `configuration.merchantOrigin`.To be able to use the JSON Web Token, your account must be approved by Google. Ask your Google contact if your business qualifies.                        |
| `configuration.merchantOrigin`    | The domain of the merchant where the request comes from. Required when using `configuration.authJwt`.                                                                                                                                                                                                                                |

#### Button options

Configure the Google Pay button. See [ButtonOptions](https://developers.google.com/pay/api/web/reference/request-objects#ButtonOptions) for more details.

| Property         | Description                                                                                                                                                                                                                                                                                        |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `buttonType`     | The [type of button](https://developers.google.com/pay/api/web/reference/object#ButtonOptions) you want displayed on your payments form.                                                                                                                                                           |
| `buttonColor`    | The [color of the button](https://developers.google.com/pay/api/web/reference/object#ButtonOptions) you want displayed on the payment form.                                                                                                                                                        |
| `buttonLocale`   | The [language on the button](https://developers.google.com/pay/api/web/reference/request-objects#ButtonOptions). Defaults to the `locale` set on the current `AdyenCheckout` instance. Supported from [Web Components v4.1.0](/online-payments/release-notes?integration_type=web\&version=4.1.0). |
| `buttonSizeMode` | Specifies whether the button changes to fill the size of its container (the default), or has a static width and height. Supported from [Web Components v4.1.0](/online-payments/release-notes?integration_type=web\&version=4.1.0).                                                                |

#### Payment data

Configure your payment requirements. See [PaymentDataRequest](https://developers.google.com/pay/api/web/reference/request-objects#PaymentDataRequest) for more details.

| Property                    | Description                                                                                                                                                                          |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `emailRequired`             | Set this to **true** if you want to collect the shopper's email address.                                                                                                             |
| `shippingAddressRequired`   | Set to **true** to request the shopper's full shipping address.                                                                                                                      |
| `shippingAddressParameters` | Set any [shipping restrictions](https://developers.google.com/pay/api/web/reference/object#ShippingAddressParameters).                                                               |
| `shippingOptionRequired`    | Set to **true** if you want to present shipping options in the payment sheet.                                                                                                        |
| `shippingOptionParameters`  | Set [shipping options](https://developers.google.com/pay/api/web/reference/request-objects#ShippingOptionParameters) and a default shipping option to be shown in the payment sheet. |

#### Card parameters

Configure accepted card types. See [Card Parameters](https://developers.google.com/pay/api/web/reference/request-objects#CardParameters) for more details.

| Property                   | Description                                                                                                                                                                                                                                                                 |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `allowedAuthMethods`       | Specify supported authentication methods. Default value is `['PAN_ONLY', 'CRYPTOGRAM_3DS']`.                                                                                                                                                                                |
| `allowedCardNetworks`      | Specify allowed [card networks](https://developers.google.com/pay/api/web/reference/request-objects#CardParameters) in capital letters. The allowed networks are automatically configured based on your account settings, but you can override this here.                   |
| `allowCreditCards`         | Default is **true**. Set this to **false** if you do not support credit cards.                                                                                                                                                                                              |
| `allowPrepaidCards`        | Default is **true**. Set this to **false** if you do not support prepaid cards.                                                                                                                                                                                             |
| `billingAddressRequired`   | Set this to **true** if you require a billing address.                                                                                                                                                                                                                      |
| `billingAddressParameters` | The expected fields returned if `billingAddressRequired` is set to true. For more information on the available fields, see Google Pay API documentation on [billingAddressParameters](https://developers.google.com/pay/api/web/reference/object#BillingAddressParameters). |

#### Payment method support

Specify which payment methods are supported. See [IsReadyToPayRequest](https://developers.google.com/pay/api/web/reference/request-objects#IsReadyToPayRequest) for more details.

| Property                        | Description          |
| ------------------------------- | -------------------- |
| `existingPaymentMethodRequired` | Default is **true**. |

#### Transaction info

Configure the transaction details. See [transaction information](https://developers.google.com/pay/api/web/reference/request-objects#TransactionInfo) for more details.

| Property           | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ------------------ |   |
| `displayItems`     | A list of cart items shown in the payment sheet such as subtotals, sales taxes, shipping charges, or discounts. Required if you implemented support for Google Pay's [Authorize Payments](https://developers.google.com/pay/api/web/guides/tutorial#authorize-payments) or [Dynamic Price Updates](https://developers.google.com/pay/api/web/guides/tutorial#price-updates). Authorize Payments also requires that you configure the `onAuthorize` [event handler](#events), and Dynamic Price Updates applies only to the [express checkout](/payment-methods/google-pay/web-component/express-checkout/) flow. |
| `countryCode`      | The [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code where the transaction is processed. Required if you process transactions in European Economic Area (EEA) locations and any other locations (such as the UK) that are subject to [Strong Customer Authentication](/online-payments/psd2-sca-compliance-and-implementation-guide/) (SCA). Use this field to specify the country code of the acquiring bank.                                                                                                                                                                |
| `currencyCode`     | The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) alphabetic currency code.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `totalPriceStatus` | The status of the total price used. Possible values:- **ESTIMATED**: Total price might adjust based on the details of the response, such as sales tax collected that's based on a billing address.
- **FINAL**: The total price does not change from the amount presented to the shopper.                                                                                                                                                                                                                                                                                                                        |
| `totalPrice`       | Total monetary value of the transaction with an optional decimal precision of two decimal places.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `totalPriceLabel`  | Custom label for the total price within the display items. Required if `displayItems` are defined.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |

#### Events

The following event handlers are supported for Google Pay.

| Event                                                      | Description                                                                                                                                                                                                                                                                                                                      |
| ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `onClick(resolve, reject)`                                 | Called when the shopper clicks the Google Pay button. Call `resolve()` or `reject()` to continue or stop the payment flow.                                                                                                                                                                                                       |
| `onChange(resolve, reject)` or `onSubmit(resolve, reject)` | Called after the shopper approves the payment on the Google Pay form. Call `resolve()` or `reject()` to continue or stop the payment flow. The first parameter (`state`) of this function contains all the necessary data to make a POST [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request. |
| `onAuthorized`                                             | Called after the shopper approves the payment on the Google Pay form. Contains the [full response from Google Pay](https://developers.google.com/pay/api/web/reference/response-objects#PaymentData). Use this if you need additional data such as the shipping address or the shopper email.                                    |

#### Example

**Example of Google Pay optional configuration**

```js
const googlePayConfiguration = {
  buttonType: 'checkout',
  buttonColor: 'white',

// The 'merchant configuration' can be set, but in the majority of cases you do not have to, because the values are returned by your backend when retrieving the configured payment methods
  configuration: {
    merchantName: 'Adyen Test merchant',
    merchantId: 'adyen.test.merchant',
    gatewayMerchantId: 'YOUR_MERCHANT_ACCOUNT_NAME'
  },

};

const googlePayComponent = checkout.create('googlepay', googlePayConfiguration);
```

## Recurring payments

To make recurring Google Pay payments, you first need to [create a shopper token](/online-payments/tokenization/create-tokens) and then [make subsequent recurring transactions](/online-payments/tokenization/make-token-payments) with the token.\
Refer to [Tokenization](/online-payments/tokenization) for more information and detailed instructions.

## Test and go live

To start testing Google Pay, log in to a Google account and create a Google Pay wallet.

There are two approaches to using this wallet for testing:

* **Enroll in test card suite**

  Enroll your wallet in Google's [test card suite](https://developers.google.com/pay/api/android/guides/resources/test-card-suite). Test card suite pre-populates your wallet with a group of cards to use in the TEST environment. These are related to Adyen's collection of test cards, and cover scenarios including:

  * Cards stored as FPAN
  * Cards stored as DPAN (only when testing through native Android and Chrome on Android)
  * Cards enabled for 3DS2

  When you start the payment flow and open the list of test cards, each card is marked with the applicable scenario.

* **Without test card suite**

  You upload real credit cards to your wallet, which are mapped to one of Adyen's [test cards](/development-resources/test-cards-and-credentials/test-card-numbers) of the same brand. Your card is not charged.

  To test 3D Secure 2, you must use American Express or Discover cards, which trigger 3D Secure 2 challenge flows in the test environment. You cannot use any other card brands.

You can check the status of a Google Pay test payment in your [Customer Area](https://ca-test.adyen.com/) > **Transactions** > **Payments**, whether you used a card from the test card suite or or not. Remember that cards outside the test card suite are mapped to an Adyen test card of the same brand.

For more information, see [Google Pay's test environment setup for Web](https://developers.google.com/pay/api/web/guides/test-and-deploy/integration-checklist#about-the-test-environment).

### Before you go live

We recommend that you test the scenarios described in [Google Pay’s API reference for web](https://developers.google.com/pay/api/web/reference/client) in your live environment.

1. Make sure that your API credential has the **API Clientside Encryption Payments role**. Check this in your [live Customer Area](https://ca-live.adyen.com/) or ask your Admin user to verify.
2. Go to your [live Customer Area](https://ca-live.adyen.com/) to configure your [Google Merchant ID](https://developers.google.com/pay/api/web/reference/request-objects#MerchantInfo).
3. Complete the steps in the Google Pay API [request production access](https://developers.google.com/pay/api/web/guides/test-and-deploy/request-prod-access).
4. Complete the steps in the Google Pay API [deploy to production documentation for Web](https://developers.google.com/pay/api/web/guides/test-and-deploy/deploy-production-environment).

In the live environment, note that Google Pay will only be available if:

* The shopper is logged in to their Google account.
* The shopper has at least one valid payment method on their Google Pay account.

## See also

* [Web Drop-in integration guide](/online-payments/drop-in-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)
