Requirements
Before starting your Google Pay integration:- Add in your Customer Area.
- Make sure that you have integrated Checkout API v67 or later.
-
Integrate Google Pay API with Adyen as your gateway. Follow the procedure in the Google Pay documentation to integrate your web or Android application.
In the step where you choose a payment tokenization method, choose Gateway. Set adyen as your
gatewayand provide your merchant or company account name in thegatewayMerchantIdparameter. Defining payment gateway for Web
Build your payment form for Google Pay
Show Google Pay as an available payment method in countries or regions where Google Pay is supported. When the shopper selects Google Pay, they are presented with the payment sheet. We provide logos for Google Pay which you can use on your payment form. For more information, refer to Downloading logos. You can also submit a /paymentMethods request specifying:- countryCode: Country or region where Google Pay is supported. For example, NL.
- amount.currency: Any supported currency. For example, EUR.
- channel: Set this to Web if the payment is being initiated on the web, or Android for in-app payments.
paymentMethod.type: googlepay.
Make a payment
-
Get the
tokenfrom thePaymentDataresponse from the Google Pay API. -
From your server, make a /payments request providing:
paymentMethod.type: googlepaygooglePayToken: Thetokenyou received from the Google Pay APIPaymentDataresponse.
For more information about the fields this token contains, refer to Google Pay API documentation.browserInfo: Required if you want to trigger 3D Secure authentication.returnUrl: URL where the shopper will be redirected after completing a 3D Secure authentication.
curl
Java
PHP
C#
NodeJS (JavaScript)
Go
Python
Ruby
NodeJS (TypeScript)
The response contains the result of the payment. /payments responseIf the shopper used a card that requires 3D Secure authentication before the payment can be completed, you receive anaction.typeredirect oraction.typethreeDS2 in the response.
- If you received an
actionobject, use the information in this object to redirect the shopper to another website to complete the 3D Secure authentication. Otherwise, proceed to presenting the payment result to your shopper.
Cards with 3D Secure: Handle the redirect
If the shopper used a card that requires 3D Secure authentication, you need to redirect the shopper to another website where they complete the authentication. To learn how to handle the redirect, follow our Handling redirects guide.Present the payment result
Use theresultCode that you received in the /payments or /payments/details response to present the payment result to your shopper.The
resultCode values you can receive for Google Pay are:
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:-
Enroll in test card suite
Enroll your wallet in Google’s 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
- Without test card suite You upload real credit cards to your wallet, which are mapped to one of Adyen’s test cards 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.
Before you go live
- 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.
-
Make sure your Google Merchant ID is configured on Adyen. When you set up a Google Pay profile, Google assigns you a unique numeric code called a Merchant ID (MID). It is this MID that must be associated with your merchant account on Adyen.
- In your live Customer Area, go to Settings > Payment methods. If you do not see the MID column, select the gear icon and then enable the MID column.
- Complete all the steps in the Google Pay API deploy to production documentation for web or for Android.
- The shopper is logged in to their Google account.
- The shopper has at least one valid payment method on their Google Pay account.