No momento, esta página não está disponível em português
Payment-method icon

Google Pay for API only

Add Google Pay to an existing API-only integration.

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

Before starting your Google Pay integration:

  1. Add Google Pay in your Customer Area.
  2. Make sure you've integrated Checkout API v67 or later.
  3. 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 gateway and provide your merchant or company account name in the gatewayMerchantId parameter.

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 paymentMethod.type: googlepay.

Make a payment

  1. Get the token from the PaymentData response from the Google Pay API.

  2. From your server, make a /payments request providing:

    • paymentMethod.type: googlepay
    • googlePayToken: The token you received from the Google Pay API PaymentData response.
      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.type redirect in the response.

  1. If you received an action object, 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 the resultCode 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:

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 refusalReason, indicating the cause of the error.
Refused The payment was refused by the shopper's bank. Ask the shopper to try the payment again using a different payment method.

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 test Google Pay in the test environment:

  1. Log in to a Google account and create a Google Pay wallet.
  2. Enrol your wallet in the Google Pay test card suite
  3. Add the details for a real card to the wallet.

After you make a test payment, you can check the status of a Google Pay test payment in your Customer Area > Transactions > Payments.

When you test with a real card, it will be masked to one of our test cards, and your card will not be charged. In your Customer Area, your test transactions show test card details of the same brand.

Limitations apply when testing Google Pay:

  • When testing with a wallet enrolled in the Google test card suite, you cannot test changes to your configuration in the PaymentDataRequest object, because the Google Pay API always returns the same output.
  • When using Google's test cards, only full PAN tokens (FPANs) are returned for test payments, instead of device authenticated tokens, known as Cryptograms.
  • To test 3D Secure 2, you can only 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.

For more information, see Google Pay's test environment setup for web or for Android.

Before you go live

  1. 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.
  2. Go to your live Customer Area to configure your Google Merchant ID.
  3. 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.

See also