{"title":"Google Pay for API only","category":"default","creationDate":1685551440,"content":"<p>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.<\/p>\n<h2>Requirements<\/h2>\n<p>Before starting your Google Pay integration:<\/p>\n<ol>\n<li><a href=\"\/pt\/payment-methods\/add-payment-methods\">Add  in your Customer Area<\/a>.<\/li>\n<li>Make sure that you have integrated <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow\/?platform=Web&amp;integration=API%20only&amp;version=71#get-available-payment-methods\">Checkout API v67 or later<\/a>.<\/li>\n<li>\n<p>Integrate Google Pay API with Adyen as your gateway. Follow the procedure in the\u00a0Google Pay documentation to integrate your <a href=\"https:\/\/developers.google.com\/pay\/api\/web\/guides\/setup\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">web<\/a> or <a href=\"https:\/\/developers.google.com\/pay\/api\/android\/guides\/setup\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Android<\/a> application.<\/p>\n<p>In the step where you choose a payment tokenization method, choose <span translate=\"no\"><strong>Gateway<\/strong><\/span>. Set\u00a0<span translate=\"no\"><strong>adyen<\/strong><\/span>\u00a0as your\u00a0<code>gateway<\/code>\u00a0and provide your merchant or company account name in the\u00a0<code>gatewayMerchantId<\/code>\u00a0parameter.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Defining payment gateway for Web'\" :id=\"''\" :code-data='[{\"language\":\"js\",\"tabTitle\":\"\",\"content\":\"\\\"tokenizationSpecification\\\": {\\n  \\\"type\\\": \\\"PAYMENT_GATEWAY\\\",\\n  \\\"parameters\\\": {\\n    \\\"gateway\\\": \\\"adyen\\\",\\n    \\\"gatewayMerchantId\\\": \\\"YOUR_MERCHANT_ACCOUNT_NAME\\\"\\n  }\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<\/ol>\n<h2>Build your payment form for Google Pay<\/h2>\n<p>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.<\/p>\n<div class=\"sc-notice info\"><div>\n<p>We provide logos for Google Pay which you can use on your payment form. For more information, refer to <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow\/?platform=Web&amp;integration=API%20only#downloading-logos\">Downloading logos<\/a>.<\/p>\n<\/div><\/div>\n<p>You can also submit a  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/paymentMethods\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/paymentMethods<\/a> request specifying:<\/p>\n<ul>\n<li> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/paymentMethods\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">countryCode<\/a>&#58; Country or region where Google Pay is supported. For example, <span translate=\"no\"><strong>NL<\/strong><\/span>.<\/li>\n<li> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/paymentMethods#request-amount\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">amount.currency<\/a>&#58; Any supported currency. For example, <span translate=\"no\"><strong>EUR<\/strong><\/span>.<\/li>\n<li> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/paymentMethods#request-channel\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">channel<\/a>&#58; Set this to\u00a0<span translate=\"no\"><strong>Web<\/strong><\/span>\u00a0if the payment is being initiated on the web, or\u00a0<span translate=\"no\"><strong>Android<\/strong><\/span>\u00a0for in-app payments.<\/li>\n<\/ul>\n<p>In the response, you receive <code>paymentMethod.type<\/code>: <span translate=\"no\"><strong>googlepay<\/strong><\/span>.<\/p>\n<h2 id=\"make-payment\">Make a payment<\/h2>\n<ol>\n<li>\n<p>Get the <code>token<\/code> from the <a href=\"https:\/\/developers.google.com\/pay\/api\/web\/reference\/response-objects#PaymentData\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">\n  <code>PaymentData<\/code>\n<\/a> response from the Google Pay API.<\/p>\n<\/li>\n<li>\n<p>From your server, make a  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/payments<\/a> request providing:<\/p>\n<ul>\n<li><code>paymentMethod.type<\/code>: <span translate=\"no\"><strong>googlepay<\/strong><\/span><\/li>\n<li><code>googlePayToken<\/code>: The <code>token<\/code> you received from the Google Pay API <a href=\"https:\/\/developers.google.com\/pay\/api\/web\/reference\/response-objects#PaymentData\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">\n  <code>PaymentData<\/code>\n<\/a> response.<br \/>\nFor more information about the fields this token contains, refer to <a href=\"https:\/\/developers.google.com\/pay\/api\/web\/guides\/resources\/payment-data-cryptography#payment-method-token-structure\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Google Pay API documentation<\/a>.<\/li>\n<li><code>browserInfo<\/code>: Required if you want to trigger <a href=\"\/pt\/online-payments\/3d-secure\/redirect-3ds2\">3D Secure authentication<\/a>.<\/li>\n<li><code>returnUrl<\/code>: URL where the shopper will be redirected after completing a 3D Secure authentication.<\/li>\n<\/ul>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"''\" :id=\"'google-pay-api'\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;curl&quot;,&quot;content&quot;:&quot;curl https:\\\/\\\/checkout-test.adyen.com\\\/v68\\\/payments \\\\\\n-H 'x-api-key: ADYEN_API_KEY' \\\\\\n-H 'content-type: application\\\/json' \\\\\\n-d '{\\n  \\&quot;merchantAccount\\&quot;:\\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n  \\&quot;reference\\&quot;:\\&quot;YOUR_ORDER_NUMBER\\&quot;,\\n  \\&quot;amount\\&quot;:{\\n    \\&quot;currency\\&quot;:\\&quot;EUR\\&quot;,\\n    \\&quot;value\\&quot;:1000\\n  },\\n  \\&quot;paymentMethod\\&quot;:{\\n    \\&quot;type\\&quot;:\\&quot;googlepay\\&quot;,\\n    \\&quot;{hint:Token from Google Pay API}googlePayToken{\\\/hint}\\&quot;: \\&quot;STATE_DATA\\&quot;\\n  },\\n   \\&quot;{hint:Required for 3D Secure}browserInfo{\\\/hint}\\&quot;:{\\n      \\&quot;userAgent\\&quot;:\\&quot;Mozilla\\\\\\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\\\\\\/537.36 (KHTML, like Gecko) Chrome\\\\\\\/70.0.3538.110 Safari\\\\\\\/537.36\\&quot;,\\n      \\&quot;acceptHeader\\&quot;:\\&quot;text\\\\\\\/html,application\\\\\\\/xhtml+xml,application\\\\\\\/xml;q=0.9,image\\\\\\\/webp,image\\\\\\\/apng,*\\\\\\\/*;q=0.8\\&quot;,\\n      \\&quot;language\\&quot;:\\&quot;nl-NL\\&quot;,\\n      \\&quot;colorDepth\\&quot;:24,\\n      \\&quot;screenHeight\\&quot;:723,\\n      \\&quot;screenWidth\\&quot;:1536,\\n      \\&quot;timeZoneOffset\\&quot;:0,\\n      \\&quot;javaEnabled\\&quot;:true\\n   },\\n  \\&quot;returnUrl\\&quot;:\\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;\\n}'&quot;},{&quot;language&quot;:&quot;java&quot;,&quot;tabTitle&quot;:&quot;Java&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Java API Library v27.0.0\\nimport com.adyen.Client;\\nimport com.adyen.enums.Environment;\\nimport com.adyen.model.checkout.*;\\nimport java.time.OffsetDateTime;\\nimport java.util.*;\\nimport com.adyen.model.RequestOptions;\\nimport com.adyen.service.checkout.*;\\n\\n\\\/\\\/ For the live environment, additionally include your liveEndpointUrlPrefix.\\nClient client = new Client(\\&quot;ADYEN_API_KEY\\&quot;, Environment.TEST);\\n\\n\\\/\\\/ Create the request object(s)\\nAmount amount = new Amount()\\n  .currency(\\&quot;EUR\\&quot;)\\n  .value(1000L);\\n\\nGooglePayDetails googlePayDetails = new GooglePayDetails()\\n  .googlePayToken(\\&quot;STATE_DATA\\&quot;)\\n  .type(GooglePayDetails.TypeEnum.GOOGLEPAY);\\n\\nBrowserInfo browserInfo = new BrowserInfo()\\n  .acceptHeader(\\&quot;text\\\/html,application\\\/xhtml+xml,application\\\/xml;q=0.9,image\\\/webp,image\\\/apng,*\\\/*;q=0.8\\&quot;)\\n  .screenWidth(1536)\\n  .javaEnabled(true)\\n  .screenHeight(723)\\n  .timeZoneOffset(0)\\n  .userAgent(\\&quot;Mozilla\\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\\/537.36 (KHTML, like Gecko) Chrome\\\/70.0.3538.110 Safari\\\/537.36\\&quot;)\\n  .language(\\&quot;nl-NL\\&quot;)\\n  .colorDepth(24);\\n\\nPaymentRequest paymentRequest = new PaymentRequest()\\n  .reference(\\&quot;YOUR_ORDER_NUMBER\\&quot;)\\n  .amount(amount)\\n  .merchantAccount(\\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;)\\n  .paymentMethod(new CheckoutPaymentMethod(googlePayDetails))\\n  .returnUrl(\\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;)\\n  .browserInfo(browserInfo);\\n\\n\\\/\\\/ Send the request\\nPaymentsApi service = new PaymentsApi(client);\\nPaymentResponse response = service.payments(paymentRequest, new RequestOptions().idempotencyKey(\\&quot;UUID\\&quot;));&quot;},{&quot;language&quot;:&quot;php&quot;,&quot;tabTitle&quot;:&quot;PHP&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen PHP API Library v19.0.0\\nuse Adyen\\\\Client;\\nuse Adyen\\\\Environment;\\nuse Adyen\\\\Model\\\\Checkout\\\\Amount;\\nuse Adyen\\\\Model\\\\Checkout\\\\CheckoutPaymentMethod;\\nuse Adyen\\\\Model\\\\Checkout\\\\BrowserInfo;\\nuse Adyen\\\\Model\\\\Checkout\\\\PaymentRequest;\\nuse Adyen\\\\Service\\\\Checkout\\\\PaymentsApi;\\n\\n$client = new Client();\\n$client-&gt;setXApiKey(\\&quot;ADYEN_API_KEY\\&quot;);\\n\\\/\\\/ For the live environment, additionally include your liveEndpointUrlPrefix.\\n$client-&gt;setEnvironment(Environment::TEST);\\n\\n\\n\\\/\\\/ Create the request object(s)\\n$amount = new Amount();\\n$amount\\n  -&gt;setCurrency(\\&quot;EUR\\&quot;)\\n  -&gt;setValue(1000);\\n\\n$checkoutPaymentMethod = new CheckoutPaymentMethod();\\n$checkoutPaymentMethod\\n  -&gt;setGooglePayToken(\\&quot;STATE_DATA\\&quot;)\\n  -&gt;setType(\\&quot;googlepay\\&quot;);\\n\\n$browserInfo = new BrowserInfo();\\n$browserInfo\\n  -&gt;setAcceptHeader(\\&quot;text\\\/html,application\\\/xhtml+xml,application\\\/xml;q=0.9,image\\\/webp,image\\\/apng,*\\\/*;q=0.8\\&quot;)\\n  -&gt;setScreenWidth(1536)\\n  -&gt;setJavaEnabled(true)\\n  -&gt;setScreenHeight(723)\\n  -&gt;setTimeZoneOffset(0)\\n  -&gt;setUserAgent(\\&quot;Mozilla\\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\\/537.36 (KHTML, like Gecko) Chrome\\\/70.0.3538.110 Safari\\\/537.36\\&quot;)\\n  -&gt;setLanguage(\\&quot;nl-NL\\&quot;)\\n  -&gt;setColorDepth(24);\\n\\n$paymentRequest = new PaymentRequest();\\n$paymentRequest\\n  -&gt;setReference(\\&quot;YOUR_ORDER_NUMBER\\&quot;)\\n  -&gt;setAmount($amount)\\n  -&gt;setMerchantAccount(\\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;)\\n  -&gt;setPaymentMethod($checkoutPaymentMethod)\\n  -&gt;setReturnUrl(\\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;)\\n  -&gt;setBrowserInfo($browserInfo);\\n\\n$requestOptions['idempotencyKey'] = 'UUID';\\n\\n\\\/\\\/ Send the request\\n$service = new PaymentsApi($client);\\n$response = $service-&gt;payments($paymentRequest, $requestOptions);&quot;},{&quot;language&quot;:&quot;cs&quot;,&quot;tabTitle&quot;:&quot;C#&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen .net API Library v17.0.0\\nusing Adyen;\\nusing Environment = Adyen.Model.Environment;\\nusing Adyen.Model;\\nusing Adyen.Model.Checkout;\\nusing Adyen.Service.Checkout;\\n\\n\\\/\\\/ For the live environment, additionally include your liveEndpointUrlPrefix.\\nvar config = new Config()\\n{\\n    XApiKey = \\&quot;ADYEN_API_KEY\\&quot;,\\n    Environment = Environment.Test\\n};\\nvar client = new Client(config);\\n\\n\\\/\\\/ Create the request object(s)\\nAmount amount = new Amount\\n{\\n  Currency = \\&quot;EUR\\&quot;,\\n  Value = 1000\\n};\\n\\nGooglePayDetails googlePayDetails = new GooglePayDetails\\n{\\n  GooglePayToken = \\&quot;STATE_DATA\\&quot;,\\n  Type = GooglePayDetails.TypeEnum.Googlepay\\n};\\n\\nBrowserInfo browserInfo = new BrowserInfo\\n{\\n  AcceptHeader = \\&quot;text\\\/html,application\\\/xhtml+xml,application\\\/xml;q=0.9,image\\\/webp,image\\\/apng,*\\\/*;q=0.8\\&quot;,\\n  ScreenWidth = 1536,\\n  JavaEnabled = true,\\n  ScreenHeight = 723,\\n  TimeZoneOffset = 0,\\n  UserAgent = \\&quot;Mozilla\\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\\/537.36 (KHTML, like Gecko) Chrome\\\/70.0.3538.110 Safari\\\/537.36\\&quot;,\\n  Language = \\&quot;nl-NL\\&quot;,\\n  ColorDepth = 24\\n};\\n\\nPaymentRequest paymentRequest = new PaymentRequest\\n{\\n  Reference = \\&quot;YOUR_ORDER_NUMBER\\&quot;,\\n  Amount = amount,\\n  MerchantAccount = \\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n  PaymentMethod = new CheckoutPaymentMethod(googlePayDetails),\\n  ReturnUrl = \\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;,\\n  BrowserInfo = browserInfo\\n};\\n\\n\\\/\\\/ Send the request\\nvar service = new PaymentsService(client);\\nvar response = service.Payments(paymentRequest, requestOptions: new RequestOptions { IdempotencyKey = \\&quot;UUID\\&quot;});&quot;},{&quot;language&quot;:&quot;js&quot;,&quot;tabTitle&quot;:&quot;NodeJS (JavaScript)&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Node API Library v18.0.0\\n\\\/\\\/ Require the parts of the module you want to use\\nconst { Client, CheckoutAPI } = require('@adyen\\\/api-library');\\n\\\/\\\/ Initialize the client object\\n\\\/\\\/ For the live environment, additionally include your liveEndpointUrlPrefix.\\nconst client = new Client({apiKey: \\&quot;ADYEN_API_KEY\\&quot;, environment: \\&quot;TEST\\&quot;});\\n\\n\\\/\\\/ Create the request object(s)\\nconst paymentRequest = {\\n  merchantAccount: \\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n  reference: \\&quot;YOUR_ORDER_NUMBER\\&quot;,\\n  amount: {\\n    currency: \\&quot;EUR\\&quot;,\\n    value: 1000\\n  },\\n  paymentMethod: {\\n    type: \\&quot;googlepay\\&quot;,\\n    googlePayToken: \\&quot;STATE_DATA\\&quot;\\n  },\\n  browserInfo: {\\n    userAgent: \\&quot;Mozilla\\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\\/537.36 (KHTML, like Gecko) Chrome\\\/70.0.3538.110 Safari\\\/537.36\\&quot;,\\n    acceptHeader: \\&quot;text\\\/html,application\\\/xhtml+xml,application\\\/xml;q=0.9,image\\\/webp,image\\\/apng,*\\\/*;q=0.8\\&quot;,\\n    language: \\&quot;nl-NL\\&quot;,\\n    colorDepth: 24,\\n    screenHeight: 723,\\n    screenWidth: 1536,\\n    timeZoneOffset: 0,\\n    javaEnabled: true\\n  },\\n  returnUrl: \\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;\\n}\\n\\n\\\/\\\/ Send the request\\nconst checkoutAPI = new CheckoutAPI(client);\\nconst response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: \\&quot;UUID\\&quot; });&quot;},{&quot;language&quot;:&quot;go&quot;,&quot;tabTitle&quot;:&quot;Go&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Go API Library v10.4.0\\nimport (\\n  \\&quot;context\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v9\\\/src\\\/common\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v9\\\/src\\\/adyen\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v9\\\/src\\\/checkout\\&quot;\\n)\\n\\\/\\\/ For the live environment, additionally include your liveEndpointUrlPrefix.\\nclient := adyen.NewClient(&amp;common.Config{\\n  ApiKey:      \\&quot;ADYEN_API_KEY\\&quot;,\\n  Environment: common.TestEnv,\\n})\\n\\n\\\/\\\/ Create the request object(s)\\namount := checkout.Amount{\\n  Currency: \\&quot;EUR\\&quot;,\\n  Value: 1000,\\n}\\n\\ngooglePayDetails := checkout.GooglePayDetails{\\n  GooglePayToken: \\&quot;STATE_DATA\\&quot;,\\n  Type: common.PtrString(\\&quot;googlepay\\&quot;),\\n}\\n\\nbrowserInfo := checkout.BrowserInfo{\\n  AcceptHeader: \\&quot;text\\\/html,application\\\/xhtml+xml,application\\\/xml;q=0.9,image\\\/webp,image\\\/apng,*\\\/*;q=0.8\\&quot;,\\n  ScreenWidth: 1536,\\n  JavaEnabled: true,\\n  ScreenHeight: 723,\\n  TimeZoneOffset: 0,\\n  UserAgent: \\&quot;Mozilla\\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\\/537.36 (KHTML, like Gecko) Chrome\\\/70.0.3538.110 Safari\\\/537.36\\&quot;,\\n  Language: \\&quot;nl-NL\\&quot;,\\n  ColorDepth: 24,\\n}\\n\\npaymentRequest := checkout.PaymentRequest{\\n  Reference: \\&quot;YOUR_ORDER_NUMBER\\&quot;,\\n  Amount: amount,\\n  MerchantAccount: \\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n  PaymentMethod: checkout.GooglePayDetailsAsCheckoutPaymentMethod(&amp;googlePayDetails),\\n  ReturnUrl: \\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;,\\n  BrowserInfo: &amp;browserInfo,\\n}\\n\\n\\\/\\\/ Send the request\\nservice := client.Checkout()\\nreq := service.PaymentsApi.PaymentsInput().IdempotencyKey(\\&quot;UUID\\&quot;).PaymentRequest(paymentRequest)\\nres, httpRes, err := service.PaymentsApi.Payments(context.Background(), req)&quot;},{&quot;language&quot;:&quot;py&quot;,&quot;tabTitle&quot;:&quot;Python&quot;,&quot;content&quot;:&quot;# Adyen Python API Library v12.5.1\\nimport Adyen\\n\\nadyen = Adyen.Adyen()\\nadyen.client.xapikey = \\&quot;ADYEN_API_KEY\\&quot;\\n# For the live environment, additionally include your liveEndpointUrlPrefix.\\nadyen.client.platform = \\&quot;test\\&quot; # The environment to use library in.\\n\\n# Create the request object(s)\\njson_request = {\\n  \\&quot;merchantAccount\\&quot;: \\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n  \\&quot;reference\\&quot;: \\&quot;YOUR_ORDER_NUMBER\\&quot;,\\n  \\&quot;amount\\&quot;: {\\n    \\&quot;currency\\&quot;: \\&quot;EUR\\&quot;,\\n    \\&quot;value\\&quot;: 1000\\n  },\\n  \\&quot;paymentMethod\\&quot;: {\\n    \\&quot;type\\&quot;: \\&quot;googlepay\\&quot;,\\n    \\&quot;googlePayToken\\&quot;: \\&quot;STATE_DATA\\&quot;\\n  },\\n  \\&quot;browserInfo\\&quot;: {\\n    \\&quot;userAgent\\&quot;: \\&quot;Mozilla\\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\\/537.36 (KHTML, like Gecko) Chrome\\\/70.0.3538.110 Safari\\\/537.36\\&quot;,\\n    \\&quot;acceptHeader\\&quot;: \\&quot;text\\\/html,application\\\/xhtml+xml,application\\\/xml;q=0.9,image\\\/webp,image\\\/apng,*\\\/*;q=0.8\\&quot;,\\n    \\&quot;language\\&quot;: \\&quot;nl-NL\\&quot;,\\n    \\&quot;colorDepth\\&quot;: 24,\\n    \\&quot;screenHeight\\&quot;: 723,\\n    \\&quot;screenWidth\\&quot;: 1536,\\n    \\&quot;timeZoneOffset\\&quot;: 0,\\n    \\&quot;javaEnabled\\&quot;: True\\n  },\\n  \\&quot;returnUrl\\&quot;: \\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;\\n}\\n\\n# Send the request\\nresult = adyen.checkout.payments_api.payments(request=json_request, idempotency_key=\\&quot;UUID\\&quot;)&quot;},{&quot;language&quot;:&quot;rb&quot;,&quot;tabTitle&quot;:&quot;Ruby&quot;,&quot;content&quot;:&quot;# Adyen Ruby API Library v9.5.1\\nrequire \\&quot;adyen-ruby-api-library\\&quot;\\n\\nadyen = Adyen::Client.new\\nadyen.api_key = 'ADYEN_API_KEY'\\n# For the live environment, additionally include your liveEndpointUrlPrefix.\\nadyen.env = :test # Set to \\&quot;live\\&quot; for live environment\\n\\n# Create the request object(s)\\nrequest_body = {\\n  :merchantAccount =&gt; 'ADYEN_MERCHANT_ACCOUNT',\\n  :reference =&gt; 'YOUR_ORDER_NUMBER',\\n  :amount =&gt; {\\n    :currency =&gt; 'EUR',\\n    :value =&gt; 1000\\n  },\\n  :paymentMethod =&gt; {\\n    :type =&gt; 'googlepay',\\n    :googlePayToken =&gt; 'STATE_DATA'\\n  },\\n  :browserInfo =&gt; {\\n    :userAgent =&gt; 'Mozilla\\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\\/537.36 (KHTML, like Gecko) Chrome\\\/70.0.3538.110 Safari\\\/537.36',\\n    :acceptHeader =&gt; 'text\\\/html,application\\\/xhtml+xml,application\\\/xml;q=0.9,image\\\/webp,image\\\/apng,*\\\/*;q=0.8',\\n    :language =&gt; 'nl-NL',\\n    :colorDepth =&gt; 24,\\n    :screenHeight =&gt; 723,\\n    :screenWidth =&gt; 1536,\\n    :timeZoneOffset =&gt; 0,\\n    :javaEnabled =&gt; true\\n  },\\n  :returnUrl =&gt; 'https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..'\\n}\\n\\n# Send the request\\nresult = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' =&gt; 'UUID' })&quot;},{&quot;language&quot;:&quot;ts&quot;,&quot;tabTitle&quot;:&quot;NodeJS (TypeScript)&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Node API Library v18.0.0\\n\\\/\\\/ Require the parts of the module you want to use\\nimport { Client, CheckoutAPI, Types } from \\&quot;@adyen\\\/api-library\\&quot;;\\n\\\/\\\/ Initialize the client object\\n\\\/\\\/ For the live environment, additionally include your liveEndpointUrlPrefix.\\nconst client = new Client({apiKey: \\&quot;ADYEN_API_KEY\\&quot;, environment: \\&quot;TEST\\&quot;});\\n\\n\\\/\\\/ Create the request object(s)\\nconst amount: Types.checkout.Amount = {\\n  currency: \\&quot;EUR\\&quot;,\\n  value: 1000\\n};\\n\\nconst googlePayDetails: Types.checkout.GooglePayDetails = {\\n  googlePayToken: \\&quot;STATE_DATA\\&quot;,\\n  type: Types.checkout.GooglePayDetails.TypeEnum.Googlepay\\n};\\n\\nconst browserInfo: Types.checkout.BrowserInfo = {\\n  acceptHeader: \\&quot;text\\\/html,application\\\/xhtml+xml,application\\\/xml;q=0.9,image\\\/webp,image\\\/apng,*\\\/*;q=0.8\\&quot;,\\n  screenWidth: 1536,\\n  javaEnabled: true,\\n  screenHeight: 723,\\n  timeZoneOffset: 0,\\n  userAgent: \\&quot;Mozilla\\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\\/537.36 (KHTML, like Gecko) Chrome\\\/70.0.3538.110 Safari\\\/537.36\\&quot;,\\n  language: \\&quot;nl-NL\\&quot;,\\n  colorDepth: 24\\n};\\n\\nconst paymentRequest: Types.checkout.PaymentRequest = {\\n  reference: \\&quot;YOUR_ORDER_NUMBER\\&quot;,\\n  amount: amount,\\n  merchantAccount: \\&quot;ADYEN_MERCHANT_ACCOUNT\\&quot;,\\n  paymentMethod: googlePayDetails,\\n  returnUrl: \\&quot;https:\\\/\\\/your-company.example.com\\\/checkout?shopperOrder=12xy..\\&quot;,\\n  browserInfo: browserInfo\\n};\\n\\n\\\/\\\/ Send the request\\nconst checkoutAPI = new CheckoutAPI(client);\\nconst response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: \\&quot;UUID\\&quot; });&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>The response contains the result of the payment.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'\/payments response'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n  \\\"pspReference\\\": \\\"JDD6LKT8MBLZNN84\\\",\\n  \\\"resultCode\\\": \\\"Authorised\\\"\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>If the shopper used a card that requires 3D Secure authentication before the payment can be completed, you receive an <code>action.type<\/code> <strong>redirect<\/strong> or <code>action.type<\/code> <strong>threeDS2<\/strong> in the response.<\/p>\n<\/li>\n<\/ol>\n<div data-component-wrapper=\"code-sample\">\n    <code-sample :title=\"'\/payments response for a card that requires 3D Secure authentication'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n      \\\"resultCode\\\": \\\"RedirectShopper\\\",\\n      \\\"action\\\": {\\n        \\\"paymentMethodType\\\": \\\"scheme\\\",\\n        \\\"url\\\": \\\"https:\\\/\\\/test.adyen.com\\\/hpp\\\/3d\\\/validate.shtml\\\",\\n        \\\"data\\\": {\\n          \\\"MD\\\": \\\"OEVudmZVMUlkWjd0MDNwUWs2bmhSdz09...\\\",\\n          \\\"PaReq\\\": \\\"eNpVUttygjAQ\\\/RXbDyAXBYRZ00HpTH3wUosPfe...\\\",\\n          \\\"TermUrl\\\": \\\"https:\\\/\\\/example.com\\\/checkout?shopperOrder=12xy...\\\"\\n        },\\n        \\\"method\\\": \\\"POST\\\",\\n        \\\"type\\\": \\\"redirect\\\"\\n      }\\n    }\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<ol start=\"3\">\n<li>If you received an <code>action<\/code> 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.<\/li>\n<\/ol>\n<h2>Cards with 3D Secure: Handle the redirect<\/h2>\n<p>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 <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow\/?platform=Web&amp;integration=API%20only#handle-the-redirect\">Handling redirects guide<\/a>.<\/p>\n<h2>Present the payment result<\/h2>\n<p>Use the\u00a0<code>resultCode<\/code> that you received in the  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/payments<\/a> or  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\/details\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/payments\/details<\/a> response to present the payment result to your shopper.<br \/>\nThe <code>resultCode<\/code> values you can receive for Google Pay are:<\/p>\n<table>\n<thead>\n<tr>\n<th>resultCode<\/th>\n<th>Description<\/th>\n<th>Action to take<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>Authorised<\/strong><\/td>\n<td>The payment was successful.<\/td>\n<td>Inform the shopper that the payment has been successful.<\/td>\n<\/tr>\n<tr>\n<td><strong>Error<\/strong><\/td>\n<td>There was an error when the payment was being processed.<\/td>\n<td>Inform the shopper that there was an error processing their payment. The response contains a <code>refusalReason<\/code>, indicating the cause of the error.<\/td>\n<\/tr>\n<tr>\n<td><strong>Refused<\/strong><\/td>\n<td>The payment was refused by the shopper's bank.<\/td>\n<td>Ask the shopper to try the payment again using a different payment method.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 id=\"recurring-payments\">Recurring payments<\/h2>\n<p>To make recurring Google Pay payments, you first need to <a href=\"\/pt\/online-payments\/tokenization\/create-tokens\">create a shopper token<\/a> and then <a href=\"\/pt\/online-payments\/tokenization\/make-token-payments\">make subsequent recurring transactions<\/a> with the token.<br \/>\nRefer to <a href=\"\/pt\/online-payments\/tokenization\">Tokenization<\/a> for more information and detailed instructions.<\/p>\n<h2 id=\"test-and-go-live\">Test and go live<\/h2>\n<p>To start testing Google Pay, log in to a Google account and create a Google Pay wallet.<\/p>\n<p>There are two approaches to using this wallet for testing:<\/p>\n<ul>\n<li>\n<p><strong>Enroll in test card suite<\/strong><\/p>\n<p>Enroll your wallet in Google's <a href=\"https:\/\/developers.google.com\/pay\/api\/android\/guides\/resources\/test-card-suite\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">test card suite<\/a>. 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:<\/p>\n<ul>\n<li>Cards stored as FPAN<\/li>\n<li>Cards stored as DPAN (only when testing through native Android and Chrome on Android)<\/li>\n<li>Cards enabled for 3DS2<\/li>\n<\/ul>\n<p>When you start the payment flow and open the list of test cards, each card is marked with the applicable scenario.<\/p>\n<\/li>\n<li>\n<p><strong>Without test card suite<\/strong><\/p>\n<p>You upload real credit cards to your wallet, which are mapped to one of Adyen's <a href=\"\/pt\/development-resources\/test-cards-and-credentials\/test-card-numbers\">test cards<\/a> of the same brand. Your card is not charged.<\/p>\n<p>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.<\/p>\n<\/li>\n<\/ul>\n<p>You can check the status of a Google Pay test payment in your <a href=\"https:\/\/ca-test.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Customer Area<\/a> &gt; <strong>Transactions<\/strong> &gt; <strong>Payments<\/strong>, 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.<\/p>\n<p>For more information, see Google Pay's test environment setup for <a href=\"https:\/\/developers.google.com\/pay\/api\/web\/guides\/test-and-deploy\/integration-checklist#about-the-test-environment\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">web<\/a> or for <a href=\"https:\/\/developers.google.com\/pay\/api\/android\/guides\/test-and-deploy\/integration-checklist#about-the-test-environment\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Android<\/a>.<\/p>\n<h3>Before you go live<\/h3>\n<ol>\n<li>\n<p>Make sure that your API credential has the <strong>API Clientside Encryption Payments role<\/strong>. Check this in your <a href=\"https:\/\/ca-live.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">live Customer Area<\/a> or ask your Admin user to verify.<\/p>\n<\/li>\n<li>\n<p>Make sure your <a href=\"https:\/\/developers.google.com\/pay\/api\/web\/reference\/request-objects#MerchantInfo\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Google Merchant ID<\/a> 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.<\/p>\n<ul>\n<li>In your <a href=\"https:\/\/ca-live.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">live Customer Area<\/a>, go to <strong>Settings<\/strong> &gt; <strong>Payment methods<\/strong>.\n<div class=\"notices green\">\n<p>If you do not see the <strong>MID<\/strong> column, select the gear icon and then enable the MID column.<\/p>\n<\/div><\/li>\n<\/ul>\n<\/li>\n<li>\n<p>Complete all the steps in the Google Pay API deploy to production documentation for <a href=\"https:\/\/developers.google.com\/pay\/api\/web\/guides\/test-and-deploy\/deploy-production-environment\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">web<\/a> or for <a href=\"https:\/\/developers.google.com\/pay\/api\/android\/guides\/test-and-deploy\/deploy-your-application\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Android<\/a>.<\/p>\n<\/li>\n<\/ol>\n<p>In production, Google Pay will only be available if:<\/p>\n<ul>\n<li>The shopper is logged in to their Google account.<\/li>\n<li>The shopper has at least one valid payment method on their Google Pay account.<\/li>\n<\/ul>\n<h2 id=\"see-also\">See also<\/h2>\n<div class=\"see-also-links output-inline\" id=\"see-also\">\n<ul><li><a href=\"\/online-payments\/api-only\"\n                        target=\"_self\"\n                        >\n                    API-only integration guide\n                <\/a><\/li><li><a href=\"https:\/\/developers.google.com\/pay\/api\/\"\n                        target=\"_blank\"\n                         class=\"external\">\n                    Google Pay API\n                <\/a><\/li><li><a href=\"\/online-payments\/tokenization\"\n                        target=\"_self\"\n                        >\n                    Tokenization\n                <\/a><\/li><li><a href=\"\/development-resources\/error-codes#google-pay-error-codes\"\n                        target=\"_self\"\n                        >\n                    Google Pay error codes\n                <\/a><\/li><li><a href=\"https:\/\/docs.adyen.com\/api-explorer\/#\/CheckoutService\/latest\/overview\"\n                        target=\"_blank\"\n                         class=\"external\">\n                    API Explorer\n                <\/a><\/li><\/ul><\/div>\n","url":"https:\/\/docs.adyen.com\/pt\/payment-methods\/google-pay\/api-only","articleFields":{"description":"Add Google Pay to an existing API-only integration.","last_edit_on":"31-05-2023 18:51","parameters":{"integration":"API-only","platform":"Web"},"feedback_component":true,"filters_component":false},"algolia":{"url":"https:\/\/docs.adyen.com\/pt\/payment-methods\/google-pay\/api-only","title":"Google Pay for API only","content":"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.\nRequirements\nBefore starting your Google Pay integration:\n\nAdd  in your Customer Area.\nMake sure that you have integrated Checkout API v67 or later.\n\nIntegrate Google Pay API with Adyen as your gateway. Follow the procedure in the\u00a0Google Pay documentation to integrate your web or Android application.\nIn the step where you choose a payment tokenization method, choose Gateway. Set\u00a0adyen\u00a0as your\u00a0gateway\u00a0and provide your merchant or company account name in the\u00a0gatewayMerchantId\u00a0parameter.\n\n\n\n\n\nBuild your payment form for Google Pay\nShow 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.\n\nWe provide logos for Google Pay which you can use on your payment form. For more information, refer to Downloading logos.\n\nYou can also submit a  \/paymentMethods request specifying:\n\n countryCode&#58; Country or region where Google Pay is supported. For example, NL.\n amount.currency&#58; Any supported currency. For example, EUR.\n channel&#58; Set this to\u00a0Web\u00a0if the payment is being initiated on the web, or\u00a0Android\u00a0for in-app payments.\n\nIn the response, you receive paymentMethod.type: googlepay.\nMake a payment\n\n\nGet the token from the \n  PaymentData\n response from the Google Pay API.\n\n\nFrom your server, make a  \/payments request providing:\n\npaymentMethod.type: googlepay\ngooglePayToken: The token you received from the Google Pay API \n  PaymentData\n response.\nFor more information about the fields this token contains, refer to Google Pay API documentation.\nbrowserInfo: Required if you want to trigger 3D Secure authentication.\nreturnUrl: URL where the shopper will be redirected after completing a 3D Secure authentication.\n\n\n\n\nThe response contains the result of the payment.\n\n\n\nIf the shopper used a card that requires 3D Secure authentication before the payment can be completed, you receive an action.type redirect or action.type threeDS2 in the response.\n\n\n\n    \n\n\nIf 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.\n\nCards with 3D Secure: Handle the redirect\nIf 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.\nPresent the payment result\nUse the\u00a0resultCode that you received in the  \/payments or  \/payments\/details response to present the payment result to your shopper.\nThe resultCode values you can receive for Google Pay are:\n\n\n\nresultCode\nDescription\nAction to take\n\n\n\n\nAuthorised\nThe payment was successful.\nInform the shopper that the payment has been successful.\n\n\nError\nThere was an error when the payment was being processed.\nInform the shopper that there was an error processing their payment. The response contains a refusalReason, indicating the cause of the error.\n\n\nRefused\nThe payment was refused by the shopper's bank.\nAsk the shopper to try the payment again using a different payment method.\n\n\n\nRecurring payments\nTo make recurring Google Pay payments, you first need to create a shopper token and then make subsequent recurring transactions with the token.\nRefer to Tokenization for more information and detailed instructions.\nTest and go live\nTo start testing Google Pay, log in to a Google account and create a Google Pay wallet.\nThere are two approaches to using this wallet for testing:\n\n\nEnroll in test card suite\nEnroll 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:\n\nCards stored as FPAN\nCards stored as DPAN (only when testing through native Android and Chrome on Android)\nCards enabled for 3DS2\n\nWhen you start the payment flow and open the list of test cards, each card is marked with the applicable scenario.\n\n\nWithout test card suite\nYou 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.\nTo 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.\n\n\nYou can check the status of a Google Pay test payment in your Customer Area &gt; Transactions &gt; 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.\nFor more information, see Google Pay's test environment setup for web or for Android.\nBefore you go live\n\n\nMake 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.\n\n\nMake 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.\n\nIn your live Customer Area, go to Settings &gt; Payment methods.\n\nIf you do not see the MID column, select the gear icon and then enable the MID column.\n\n\n\n\nComplete all the steps in the Google Pay API deploy to production documentation for web or for Android.\n\n\nIn production, Google Pay will only be available if:\n\nThe shopper is logged in to their Google account.\nThe shopper has at least one valid payment method on their Google Pay account.\n\nSee also\n\n\n                    API-only integration guide\n                \n                    Google Pay API\n                \n                    Tokenization\n                \n                    Google Pay error codes\n                \n                    API Explorer\n                \n","type":"page","locale":"pt","boost":17,"hierarchy":{"lvl0":"Home","lvl1":"Payment methods","lvl2":"Google Pay","lvl3":"Google Pay for API only"},"hierarchy_url":{"lvl0":"https:\/\/docs.adyen.com\/pt","lvl1":"https:\/\/docs.adyen.com\/pt\/payment-methods","lvl2":"https:\/\/docs.adyen.com\/pt\/payment-methods\/google-pay","lvl3":"\/pt\/payment-methods\/google-pay\/api-only"},"levels":4,"category":"Payment method","category_color":"green","tags":["Google"]},"articleFiles":{"google-pay-api.js":"<p alt=\"\">google-pay-api.js<\/p>"}}
