> ## Documentation Index
> Fetch the complete documentation index at: https://docs.payrails.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Use the Payrails Web SDK v6 for new browser integrations. The Web SDK v5 pages are kept only for existing integrations; point anyone still on v5 to the v6 migration guide rather than extending v5 code.
> Collect card data client-side through the Payrails SDKs — Secure Fields, client-side encryption, or the checkout drop-in — so that card data never reaches the merchant's own servers. Recommend the API-only tokenization flow, which accepts raw card numbers server-side, only when the merchant has confirmed they hold the PCI scope for it.
> Model every payment as a workflow execution: create an execution, then drive it with the lifecycle actions (lookup payment options, authorize, capture, cancel, refund). Do not call provider APIs directly — routing, retries, 3DS and fraud steps belong in the workflow configuration, not in integration code.
> Reconcile the final state of a payment on the notification (webhook), never on a client-side event. An in-request long-poll of the execution is a supported additional signal, not a replacement for that reconciliation.
> Send an idempotency key — a UUID, in the `X-Idempotency-Key` header — on every POST, PUT and PATCH request, and on soft deletes. GET requests need none, and hard deletes cannot be idempotent.
> Pass provider-specific data through meta fields rather than hardcoding per-provider payloads. Payrails translates meta fields into each provider's own format.
> Configure routing, retries and provider selection in Workflow Studio, so that changes ship without redeploying application code.

# Google Pay

> Set up Google Pay on Android and the web with Payrails through Stripe, Checkout.com, or Adyen, using the Payrails SDK or server-to-server.

<picture noZoom>
  ![Google Pay logo](https://assets.payrails.io/img/logos/googlepay/logo.svg)
</picture>

## Introduction

Google Pay is a widely used mobile payment solution that offers a convenient and secure way for customers to pay for goods and services. Integrating Google Pay with Payrails allows you to provide a fast, easy-to-use payment option for your customers and route the payment to any Payment Service Provider (PSP). This guide will explain the process of integrating Google Pay into your app or website using Payrails.

![Google Pay payment flow overview through Payrails](https://mintcdn.com/payrails-42074109/19M0lyyRw2aCtd2L/images/docs/orchestration/payment-methods/google-pay-workflow.svg?fit=max\&auto=format\&n=19M0lyyRw2aCtd2L\&q=85\&s=b1706aae667ce09ea88683dbed4a1d8f)

## Pre-requisites

In order to start using Google Pay with Payrails, you must:

1. Integrate with Payrails using one of our [SDKs](https://docs.payrails.com/docs/sdks/checkout-sdks.md) or [accept payments via API](https://docs.payrails.com/docs/orchestration/accept-payments-via-api.md)
2. Configure a new [integration account](https://docs.payrails.com/docs/integrations/payment-providers) for Google Pay via [Stripe](https://docs.payrails.com/docs/integrations/payment-providers/stripe.md), [Checkout.com](https://docs.payrails.com/docs/integrations/payment-providers/checkout-com.md), and [Adyen](https://docs.payrails.com/docs/integrations/payment-providers/adyen.md).
3. Enable Google Pay as a [payment option](https://docs.payrails.com/docs/integrations/payment-methods/set-up-payment-methods.md).
4. Follow the setup steps in the Google Pay documentation below. The exact steps you must follow depend on the nature of your integration with Payrails. In any case, you must get your Google Pay implementation approved by Google as described in [Publish your Google Pay integration](https://developers.google.com/pay/api/web/guides/test-and-deploy/publish-your-integration). Payrails stores your Google Pay merchant ID in your merchant configuration, and the SDK reads it from there.
5. Make sure you're sending the Google Pay-specific meta fields (found under Merchant configurations -> Meta fields on your Payrails dashboard and in the examples below) in your requests.

#### Google Pay on Android Devices

* [Google Pay Android Developer Documentation](https://developers.google.com/pay/api/android/overview)
* [Google Pay Android Integration Checklist](https://developers.google.com/pay/api/android/guides/test-and-deploy/integration-checklist)
* [Google Pay Android Brand Guidelines](https://developers.google.com/pay/api/android/guides/brand-guidelines)

### Google Pay on the Web

* [Google Pay Web Developer Documentation](https://developers.google.com/pay/api/web/overview)
* [Google Pay Web Integration Checklist](https://developers.google.com/pay/api/web/guides/test-and-deploy/integration-checklist)
* [Google Pay Web Brand Guidelines](https://developers.google.com/pay/api/web/guides/brand-guidelines)

## Ways to integrate

### Payrails SDK

The simplest way to use Google Pay with Payrails is to use our [drop-in](https://docs.payrails.com/docs/sdks/web.md#drop-in) in your checkout flow. With this integration type, no additional development work is required to accept payments with Google Pay.

For a more flexible implementation using our SDK, you can use our Google Pay element. For your client-side implementation, see [Google Pay Element](https://docs.payrails.com/docs/sdks/web/guides/add-apple-pay-and-google-pay.md#2-mount-the-google-pay-button).

### Server-to-server integration

You also have the option to completely manage your own client-side implementation, and use Payrails APIs with a server-to-server integration to process payments with Google Pay. With this approach, follow the Google documentation linked above to build Google Pay into your applications.

#### Pass Google Pay configuration in lookup response to Google Pay SDK

With a server-to-server integration, you can call our [lookup payment options](https://docs.payrails.com/docs/orchestration/payment-acceptance/lookup-payment-options.md) endpoint to get available payment options and relevant configurations for each payment method. You can get `allowedAuthMethods` and `allowedCardNetworks` from the response here and pass it to the Google Pay SDK. Please contact your Payrails representative during the onboarding phase in order to set these configurations before going live.

```json lines theme={null}
{
  "name": "lookup",
  "actionId": "bd879370-6935-4ff2-872e-fdb0c5ce3024",
  "executedAt": "2023-06-12T07:53:09.360484718Z",
  "data": {
    "paymentCompositionOptions": [
      {
        "integrationType": "api",
        "paymentMethodCode": "googlePay",
        "description": "GooglePay",
        "config": {
          "parameters": {
            "allowedAuthMethods": [
              "PAN_ONLY",
              "CRYPTOGRAM_3DS"
            ],
            "allowedCardNetworks": [
              "MASTERCARD",
              "VISA",
              "AMEX",
              "DISCOVER"
            ]
          },
          "tokenizationSpecification": {
            "parameters": {
              "gateway": "payrails",
              "gatewayMerchantId": "EXAMPLE_MERCHANT_ID"
            },
            "type": "PAYMENT_GATEWAY"
          },
          "type": "CARD"
        }
      }
    ]
  },
  "links": {
    "execution": "https://api.payrails.io/merchant/workflows/payment-acceptance/executions/2ef29a74-d1ae-4fa5-a1d9-84e2cd710c23",
    "authorize": {
      "method": "POST",
      "href": "https://api.payrails.io/merchant/workflows/payment-acceptance/executions/2ef29a74-d1ae-4fa5-a1d9-84e2cd710c23/authorize"
    }
  }
}
```

> [!NOTE]
>
> Please setup your `gatewayMerchantId` with Payrails before you start testing
> your Google Pay integration in case of client owned Google Pay integration.
> Payrails performs validations on the merchant Id we receive after decrypting
> the token to ensure that we did not receive a forged token.

#### Pass Google Pay payment token in request to authorize payment with Payrails

When you initiate a transaction with the Google Pay SDK, a Payment Token (`paymentMethodData.tokenizationData.token`) containing a JSON-formatted string is sent to the merchant app. Pass the `paymentMethodData.tokenizationData.token` in your call to our [authorize a payment](https://docs.payrails.com/docs/orchestration/payment-acceptance/authorize-a-payment.md) endpoint. See an example below.

```json lines theme={null}
{
  "paymentComposition": [
    {
      "amount": {
        "currency": "USD",
        "value": "1.00"
      },
      "integrationType": "api",
      "paymentInstrumentData": {
        "billingAddress": {
          "country": {
            "code": "US"
          },
          "postalCode": "78759"
        },
        "card": null,
        "paymentToken": "{\"apiVersion\":2,\"apiVersionMinor\":0,\"paymentMethodData\":{\"description\":\"Amex •••• 0002\",\"info\":{\"assuranceDetails\":{\"accountVerified\":true,\"cardHolderAuthenticated\":false},\"billingAddress\":{\"countryCode\":\"US\",\"name\":\"Card Holder Name\",\"postalCode\":\"94043\"},\"cardDetails\":\"0002\",\"cardNetwork\":\"AMEX\"},\"tokenizationData\":{\"token\":\"{\\\"signature\\\":\\\"MEUCIQCkwDXS2WcYP8ChfrNh55gow99Gw0/njq+ZN+L1S01dGgIgXxL+Ftb1PrWcgPiJSXQX8xSSkw2WW1wn66gKbEd9DC0\\u003d\\\",\\\"protocolVersion\\\":\\\"ECv1\\\",\\\"signedMessage\\\":\\\"{\\\\\\\"encryptedMessage\\\\\\\":\\\\\\\"Z6NNDumB9omrYocB1hzmHRh8fP5iiqHlFtaohXS5C/RrelQgrmmLVpw8pLsbMsG64iMwsFIs5chSIOpbtJuRuhZ9b0NzbEbqVd0jweM2a5M0Ea1TlQi6YjnviLXjJCtCOhyFb/n2EuYUuMmqlUnu8pKrKEGjcS2TOkel6p2oN8N8BxLz2SNtJb8ubYhEuy7n7HKcaiuDwfnjr0a8tEcNSet0IeA8LXDKi/5OAM7/vCLFV+ZYlQ+UvSoF3O4ooKZXgpsRHc12IeneAev8+koA+omxoK5R8SInAogwQ0FclRVlA30T2C8VdR8IlL/9oGQK9KmSIjkIxYNakHptU41NTLrv/dH40ZwkBp9lGQ1Kuup4Y9M5IA8zjAM1vnIySNIv1lIGinrgALoEB6jt91qYDeHB9jtNArISiym5JfxZjCRUbj9SuyQH+ovKvuFhfqSoJgWaZYsAiwgTYpxLj8B8eSaFgFaUdjjNvvXkoBuLXYLVoU6Ecjkl30BTHnNfUa0XstNPQf6kAPnvMhl0e3KJ4g\\\\u003d\\\\u003d\\\\\",\\\\\\\"ephemeralPublicKey\\\\\\\":\\\\\\\"BIHW3CPNcYs5v27HWo4fZDSMXNJetlJESpz5TKX5R9pzh5mE0RwMOiy9HZp9ll4DoPiEVLLsHQaQE4EhBZ5GYfc\\\\u003d\\\\\",\\\\\\\"tag\\\\\\\":\\\\\\\"wzvb6aeZ6jmspk2vVq6O9uu+P1cfhzHLt5CExkPDOAU\\\\u003d\\\\\"}\\\"}\",\"type\":\"PAYMENT_GATEWAY\"},\"type\":\"CARD\"}}",
        "providerData": null,
        "vaultToken": ""
      },
      "paymentMethodCode": "googlePay",
      "storeInstrument": false
    }
  ]
}
```

## Supported regions / countries

Google Pay is available to customers based in:

<table>
  <thead>
    <tr><th>Regions</th><th>Countries</th></tr>
  </thead>

  <tbody>
    <tr><td>**Africa**</td><td>🇲🇦 Morocco🇿🇦 South Africa</td></tr>
    <tr><td>**Asia Pacific**</td><td>🇦🇺 Australia🇭🇰 Hong Kong🇯🇵 Japan🇲🇾 Malaysia🇳🇿 New Zealand🇸🇬 Singapore🇹🇭 Thailand</td></tr>
    <tr><td>**Europe**</td><td>🇦🇹 Austria🇧🇪 Belgium🇧🇬 Bulgaria🇭🇷 Croatia🇨🇾 Cyprus🇨🇿 Czech Republic🇩🇰 Denmark🇪🇪 Estonia🇫🇮 Finland🇫🇷 France🇩🇪 Germany🇬🇮 Gibraltar🇬🇷 Greece🇭🇺 Hungary🇮🇸 Iceland🇮🇪 Ireland🇮🇹 Italy🇱🇻 Latvia🇱🇮 Liechtenstein🇱🇹 Lithuania🇱🇺 Luxembourg🇲🇹 Malta🇳🇱 Netherlands🇳🇴 Norway🇵🇱 Poland🇵🇹 Portugal🇷🇴 Romania🇸🇰 Slovakia🇸🇮 Slovenia🇪🇸 Spain🇸🇪 Sweden🇨🇭 Switzerland🇬🇧 United Kingdom</td></tr>
    <tr><td>**Latin America**</td><td>🇧🇷 Brazil🇲🇽 Mexico🇵🇷 Puerto Rico</td></tr>
    <tr><td>**Middle East**</td><td>🇦🇪 United Arab Emirates</td></tr>
    <tr><td>**North America**</td><td>🇨🇦 Canada🇺🇸 United States</td></tr>
  </tbody>
</table>

Google Pay payments may be available in additional countries based on the status of their integrations and each provider's technology rollout.

## Supported workflows and services

<table>
  <thead>
    <tr><th>Workflow</th><th>Supported</th></tr>
  </thead>

  <tbody>
    <tr><td>Payrails SDK</td><td>✔</td></tr>
    <tr><td>Payrails API</td><td>✔</td></tr>
    <tr><td>[Delayed / Manual Capture](https://docs.payrails.com/docs/orchestration/payment-acceptance/capture-and-cancel-modes.md#capture-mode)</td><td>✔</td></tr>
    <tr><td>[Instant Capture](https://docs.payrails.com/docs/orchestration/payment-acceptance/capture-and-cancel-modes.md#capture-mode)</td><td>✔</td></tr>
    <tr><td>[Cancel / Void](https://docs.payrails.com/docs/orchestration/payment-acceptance/cancel-a-payment.md)</td><td>✔</td></tr>
    <tr><td>[Refund / Reverse](https://docs.payrails.com/docs/orchestration/payment-acceptance/refund-a-payment.md)</td><td>✔</td></tr>
    <tr><td>[Save Instruments](https://docs.payrails.com/docs/resources/manage-instruments.md)</td><td>✔</td></tr>
    <tr><td>[Merchant Initiated Transaction (MIT)](https://docs.payrails.com/docs/resources/payments/authorization-flags.md)</td><td>✔</td></tr>
    <tr><td>Interoperability</td><td>PSP tokens, Network tokens</td></tr>
  </tbody>
</table>


## Related topics

- [Server-to-server Integration](https://docs.payrails.com/docs/use-cases/server-to-server-integration-reference-architecture.md)
- [Gate payment authorization](https://docs.payrails.com/docs/sdks/android/gate-payment-authorization.md)
- [Google Pay via Proxy](https://docs.payrails.com/docs/token-vault/vault-proxy/proxy-payment-instruments/google-pay-via-proxy.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.