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 an existing Drop-in integration. |
Setup steps | Before you begin: . |
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: This is the default with Drop-in v5.0.0 or later.
- /payments: If you implemented an additional use case.
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:
<script src="https://pay.google.com/gp/p/js/pay.js"></script>
If you are loading the Drop-in inside an iframe element, add the allow
attribute to the iframe to render Google Pay. For example:
<iframe allow="payment">
</iframe>
Required configuration
Select which endpoint you are using:
Optional configuration
This optional configuration parameter 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 Google Pay configuration
You can configure the following:
- Merchant info
- Button options
- Payment data
- Card parameters
- Payment method support
- Transaction info
- Events
Merchant info
Configure the merchant name rendered in the payment sheet. See 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. 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. |
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 for more details.
Property | Description |
---|---|
buttonType |
The type of button you want displayed on your payments form. |
buttonColor |
The color of the button you want displayed on the payment form. |
buttonLocale |
The language on the button. Defaults to the locale set on the current AdyenCheckout instance. Supported from Web Components v4.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. |
Payment data
Configure your payment requirements. See 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. |
shippingOptionRequired |
Set to true if you want to present shipping options in the payment sheet. |
shippingOptionParameters |
Set shipping options and a default shipping option to be shown in the payment sheet. |
Card parameters
Configure accepted card types. See Card Parameters for more details.
Property | Description |
---|---|
allowedAuthMethods |
Specify supported authentication methods. Default value is ['PAN_ONLY', 'CRYPTOGRAM_3DS'] . |
allowedCardNetworks |
Specify allowed card networks 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. |
Payment method support
Specify which payment methods are supported. See IsReadyToPayRequest for more details.
Property | Description |
---|---|
existingPaymentMethodRequired |
Default is true. |
Transaction info
Configure the transaction details. See transaction information 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 or Dynamic Price Updates. Authorize Payments also requires that you configure the onAuthorize event handler, and Dynamic Price Updates applies only to the express checkout flow. |
countryCode |
The 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 that are subject to Strong Customer Authentication (SCA). Use this field to specify the country code of the acquiring bank. |
currencyCode |
The ISO 4217 alphabetic currency code. |
totalPriceStatus |
The status of the total price used. Possible values:
|
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 or onSubmit |
Called after the shopper approves the payment on the Google Pay form. The first parameter (state ) of this function contains all the necessary data to make a payment using the /payments API. |
onAuthorized |
Called after the shopper approves the payment on the Google Pay form. Contains the full response from Google Pay. Use this if you need additional data such as the shipping address or the shopper email. |
Example
Recurring payments
To make recurring Google Pay payments, you first need to create a shopper token and then make subsequent recurring transactions with the token.
Refer to 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:
You can check the status of a Google Pay test payment in your Customer Area > 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.
Before you go live
We recommend that you test the scenarios described in Google Pay’s API reference for web in your live environment.
- Make sure that your API credential has the API Clientside Encryption Payments role. Check this in your live Customer Area or ask your Admin user to verify.
- Go to your live Customer Area to configure your Google Merchant ID.
- Complete the steps in the Google Pay API request production access.
- Complete the steps in the Google Pay API deploy to production documentation for Web.
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.