Accept Google Pay payments using our APIs, and build your own payment form to have full control over the look and feel of your checkout page.
Before you begin
These instructions explain how to add Google Pay to your existing API-only integration. The API-only integration works the same way for all payment methods. If you haven't done this integration yet, refer to our API-only integration guide.
Before starting your Google Pay integration:
- Add Google Pay in your Customer Area.
- Make sure you've integrated Checkout API v67 or later.
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 the
Build your payment form for Google Pay
Show Google Pay as an available payment method in countries 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 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.
In the response, you receive
Make a payment
PaymentDataresponse from the Google Pay API.
From your server, make a /payments request providing:
tokenyou received from the Google Pay API
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.
The response contains the result of the payment.
If the shopper used a card that requires 3D Secure authentication before the payment can be completed, you receive an
action.typeredirect 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
|resultCode||Description||Action to take|
|Authorised||The payment was successful.||Inform the shopper that the payment has been successful.|
|Error||There was an error when the payment was being processed.||Inform the shopper that there was an error processing their payment. The response contains a
|Refused||The payment was refused by the shopper's bank.||Ask the shopper to try the payment again using a different payment method.|
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 test Google Pay, log in to a Google account, create a Google Pay wallet and add the details for a real card.
When you test with this card it will be masked to one of our test cards, so there are no charges to your card. Your test transactions show test card details of the same brand in your Customer Area.
You can enrol your wallet in the Google Pay test card suite to use their test cards, which cover a limited number of scenarios. For example, you cannot test changes to your configuration in the
PaymentDataRequest object using the Google Pay test card suite because Google Pay API always returns the same output.
Currently, Google Pay wallets enrolled in the Test Card Suite return only full PAN tokens (FPANs) for test payments, and not device authenticated tokens AKA Cryptograms.
To test 3D Secure 2, you can use American Express or Discover cards, which trigger 3D Secure 2 challenge flows in the test environment. You cannot use any other card brands or any of Google Pay's test cards to test 3D Secure 2.
You can check the status of a Google Pay test payment in your Customer Area > Transactions > Payments.
Before you go live
- Make sure 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 all the steps in the Google Pay API deploy to production documentation for web or for Android.
In production, 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.