Are you looking for test card numbers?

Would you like to contact support?

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

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:

  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.

    Defining payment gateway for Web
    "tokenizationSpecification": {
      "type": "PAYMENT_GATEWAY",
      "parameters": {
        "gateway": "adyen",
        "gatewayMerchantId": "YOUR_MERCHANT_ACCOUNT_NAME"
      }
    }

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  PaymentData response from the Google Pay API. 

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

    • paymentMethod.type: googlepay
    • googlePayToken: This is the token that you obtained 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 back to after completing a 3D Secure authentication.
    curl https://checkout-test.adyen.com/v68/payments \
    -H "x-API-key: YOUR_X-API-KEY" \
    -H "content-type: application/json" \
    -d '{
      "merchantAccount":"YOUR_MERCHANT_ACCOUNT",
      "reference":"YOUR_ORDER_NUMBER",
      "amount":{
        "currency":"EUR",
        "value":1000
      },
      "paymentMethod":{
        "type":"googlepay",
        "{hint:Token from Google Pay API}googlePayToken{/hint}": "{\"signature\":\"MEUCIFNbi10fa\\u003d\",\"protocolVersion\":\"ECv1\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"u4YsMQ4i56lTS..D+2m9vYwY\\\",\\\"ephemeralPublicKey\\\":\\\"BIwdzX4a+rC1DiKY6/8Y\\\\u003d\\\",\\\"tag\\\":\\\"pe0MF+z7\\\\u003d\\\"}\"}"
      },
       "{hint:Required for 3D Secure}browserInfo{/hint}":{
          "userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
          "acceptHeader":"text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
          "language":"nl-NL",
          "colorDepth":24,
          "screenHeight":723,
          "screenWidth":1536,
          "timeZoneOffset":0,
          "javaEnabled":true
       },
      "returnUrl":"https://your-company.com/checkout?shopperOrder=12xy.."
    }'
    # Set your X-API-KEY with the API key from the Customer Area.
    adyen = Adyen::Client.new
    adyen.api_key = "YOUR_X-API-KEY"
     
    response = adyen.checkout.payments({
      :amount => {
        :currency => "EUR",
        :value => 1000
      },
      :reference => "YOUR_ORDER_NUMBER",
      :paymentMethod => {
        :type => "googlepay",
        :googlePayToken => "{\"signature\":\"MEUCIFNbi10fa\\u003d\",\"protocolVersion\":\"ECv1\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"u4YsMQ4i56lTS..D+2m9vYwY\\\",\\\"ephemeralPublicKey\\\":\\\"BIwdzX4a+rC1DiKY6/8Y\\\\u003d\\\",\\\"tag\\\":\\\"pe0MF+z7\\\\u003d\\\"}\"}"
      },
      :browserInfo => {
        :userAgent => "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        :acceptHeader => "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        :language => "nl-NL",
        :colorDepth => 24,
        :screenHeight => 723,
        :screenWidth => 1536,
        :timeZoneOffset => 0,
        :javaEnabled => "true"
      },
      :returnUrl => "https://your-company.com/checkout?shopperOrder=12xy..",
      :merchantAccount => "YOUR_MERCHANT_ACCOUNT"
    })
    // Set YOUR_X-API-KEY with the API key from the Customer Area.
    // Change to Environment.LIVE and add the Live URL prefix when you're ready to accept live payments.
        Client client = new Client("YOUR_X-API-KEY", Environment.TEST);
        Checkout checkout = new Checkout(client);
    
        PaymentsRequest paymentsRequest = new PaymentsRequest();
    
        String merchantAccount = "YOUR_MERCHANT_ACCOUNT";
        paymentsRequest.setMerchantAccount(merchantAccount);
    
        Amount amount = new Amount();
        amount.setCurrency("EUR");
        amount.setValue(15000L);
        paymentsRequest.setAmount(amount);
    
        GooglePayDetails googlePayDetails = new GooglePayDetails();
    
        googlePayDetails.setGooglePayToken(state.data.paymentMethod.googlePayToken);
        paymentsRequest.setPaymentMethod(googlePayDetails);
    
        browserInfo.setUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36");
        browserInfo.setAcceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
        browserInfo.setLanguage("nl-NL");
        browserInfo.setColorDepth(24);
        browserInfo.setScreenHeight(723);
        browserInfo.setScreenWidth(1536);
        browserInfo.setTimeZoneOffset(0);
        browserInfo.setJavaEnabled(true);
    
        paymentsRequest.setBrowserInfo(browserInfo);
    
        paymentsRequest.setReference("YOUR_ORDER_NUMBER");
        paymentsRequest.setReturnUrl("https://your-company.com/checkout?shopperOrder=12xy..");
    
        PaymentsResponse paymentsResponse = checkout.payments(paymentsRequest);
    // Set your X-API-KEY with the API key from the Customer Area.
    $client = new \Adyen\Client();
    $client->setXApiKey("YOUR_X-API-KEY");
    $service = new \Adyen\Service\Checkout($client);
    
    $params = array(
      "amount" => array(
        "currency" => "EUR",
        "value" => 1000
      ),
      "reference" => "YOUR_ORDER_NUMBER",
      "paymentMethod" => array(
        "type" => "googlepay",
        "googlePayToken" => "{\"signature\":\"MEUCIFNbi10fa\\u003d\",\"protocolVersion\":\"ECv1\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"u4YsMQ4i56lTS..D+2m9vYwY\\\",\\\"ephemeralPublicKey\\\":\\\"BIwdzX4a+rC1DiKY6/8Y\\\\u003d\\\",\\\"tag\\\":\\\"pe0MF+z7\\\\u003d\\\"}\"}"
      ),
      "browserInfo" => [
        "userAgent" => "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        "acceptHeader" => "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        "language" => "nl-NL",
        "colorDepth" => 24,
        "screenHeight" => 723,
        "screenWidth" => 1536,
        "timeZoneOffset" => 0,
        "javaEnabled" => true
      ],
      "merchantAccount" => "YOUR_MERCHANT_ACCOUNT",
      "returnUrl" => "https://your-company.com/checkout?shopperOrder=12xy.."
    );
    $result = $service->payments($params);
    #Set your X-API-KEY with the API key from the Customer Area.
    adyen = Adyen.Adyen()
    adyen.client.xapikey = 'YOUR_X-API-KEY'
    
    result = adyen.checkout.payments({
       'amount': {
          'value': 1000,
          'currency': 'EUR'
       },
       'reference': 'YOUR_ORDER_NUMBER',
       'paymentMethod': {
          'type': 'googlepay',
          'googlePayToken': '{\"signature\":\"MEUCIFNbi10fa\\u003d\",\"protocolVersion\":\"ECv1\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"u4YsMQ4i56lTS..D+2m9vYwY\\\",\\\"ephemeralPublicKey\\\":\\\"BIwdzX4a+rC1DiKY6/8Y\\\\u003d\\\",\\\"tag\\\":\\\"pe0MF+z7\\\\u003d\\\"}\"}'
       },
       'browserInfo': {
         'userAgent': 'Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36',
         'acceptHeader': 'text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8',
         'language': 'nl-NL',
         'colorDepth': 24,
         'screenHeight': 723,
         'screenWidth': 1536,
         'timeZoneOffset': 0,
         'javaEnabled': 'true'
       },
       'returnUrl': 'https://your-company.com/checkout?shopperOrder=12xy..',
       'merchantAccount': 'YOUR_MERCHANT_ACCOUNT'
    })
    // Set your X-API-KEY with the API key from the Customer Area.
    var client = new Client ("YOUR_X-API-KEY", Environment.Test);
    var checkout = new Checkout(client);
    
    var amount = new Adyen.Model.Checkout.Amount("EUR", 1000);
    var details = new GooglePayDetails{
      Type = "googlepay",
      GooglePayToken = "{\"signature\":\"MEUCIFNbi10fa\\u003d\",\"protocolVersion\":\"ECv1\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"u4YsMQ4i56lTS..D+2m9vYwY\\\",\\\"ephemeralPublicKey\\\":\\\"BIwdzX4a+rC1DiKY6/8Y\\\\u003d\\\",\\\"tag\\\":\\\"pe0MF+z7\\\\u003d\\\"}\"}"
    };
    var browserInfo = new Adyen.Model.Checkout.BrowserInfo
    {
        UserAgent = @"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36",
        AcceptHeader = @"text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8",
        Language = "nl-NL",
        ColorDepth = 24,
        ScreenHeight = 723,
        ScreenWidth = 1536,
        TimeZoneOffset = 0,
        JavaEnabled = true
    };
    var paymentsRequest = new Adyen.Model.Checkout.PaymentRequest
    {
      Reference = "YOUR_ORDER_NUMBER",
      Amount = amount,
      ReturnUrl = @"https://your-company.com/checkout?shopperOrder=12xy..",
      MerchantAccount = "YOUR_MERCHANT_ACCOUNT",
      PaymentMethod = details,
      BrowserInfo = browserInfo
    };
    
    var paymentResponse = checkout.Payments(paymentsRequest);
    // Set your X-API-KEY with the API key from the Customer Area.
    const {Client, Config, CheckoutAPI} = require('@adyen/api-library');
    const config = new Config();
    // Set your X-API-KEY with the API key from the Customer Area.
    config.apiKey = '[API_KEY]';
    config.merchantAccount = '[YOUR_MERCHANT_ACCOUNT]';
    const client = new Client({ config });
    client.setEnvironment("TEST");
    const checkout = new CheckoutAPI(client);
    checkout.payments({
        amount: { currency: "EUR", value: 1000 },
        paymentMethod: {
            type: 'googlepay',
            googlePayToken: '{\"signature\":\"MEUCIFNbi10fa\\u003d\",\"protocolVersion\":\"ECv1\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"u4YsMQ4i56lTS..D+2m9vYwY\\\",\\\"ephemeralPublicKey\\\":\\\"BIwdzX4a+rC1DiKY6/8Y\\\\u003d\\\",\\\"tag\\\":\\\"pe0MF+z7\\\\u003d\\\"}\"}'
        },
        browserInfo:{
            userAgent: 'Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36',
            acceptHeader: 'text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8',
            language: 'nl-NL',
            colorDepth: 24,
            screenHeight: 723,
            screenWidth: 1536,
            timeZoneOffset: 0,
            javaEnabled: true
        },
        reference: "YOUR_ORDER_NUMBER",
        merchantAccount: config.merchantAccount,
        returnUrl: "https://your-company.com/checkout?shopperOrder=12xy.."
    }).then(res => res);

    The response contains the result of the payment.

    /payments response
    {
      "pspReference": "JDD6LKT8MBLZNN84",
      "resultCode": "Authorised"
    }

    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.

/payments response for a card that requires 3D Secure authentication
  {
        "resultCode": "RedirectShopper",
        "action": {
          "paymentMethodType": "scheme",
          "url": "https://test.adyen.com/hpp/3d/validate.shtml",
          "data": {
            "MD": "OEVudmZVMUlkWjd0MDNwUWs2bmhSdz09...",
            "PaReq": "eNpVUttygjAQ/RXbDyAXBYRZ00HpTH3wUosPfe...",
            "TermUrl": "https://example.com/checkout?shopperOrder=12xy..."
          },
          "method": "POST",
          "type": "redirect"
        }
      }
  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, log in to a Google account and create a Google Pay wallet with the details of a real card, not a test card. When you make a test payment, the card number is automatically mapped to our test card number starting with 4111, so the real card is not charged.

To test Google Pay with the 3D Secure flow, contact our Support Team.

You can check the status of a Google Pay test payment in your Customer Area > Transactions > Payments.

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