# Direct Integration

With Direct integration, you integrate with the Google Pay™ API on your frontend, obtain the encrypted payment token from Google, and pass it to WHITELABEL's API for processing. This gives you full control over the Google Pay user experience.

**Workflow:** `DIRECT`

<Note>
  Not sure which integration to use? See the [Google Pay overview](/docs/google-pay#integration-options) to compare all three options.
</Note>

## Requirements

Before starting, ensure you meet the [general Google Pay requirements](/docs/google-pay#requirements). Additionally, you need to register with the [Google Pay Business Console](https://pay.google.com/business/console) to obtain a Google merchant ID. Complete the console configuration by following these steps:

1. Complete the **Business Profile**

2. Review the information required in **Google Pay API** > **Integrate with your website**:

   * Your website – This must exactly match the domain of your hosted checkout page (with or without "www")
   * Integration type – **GATEWAY**

3. Screenshots:

* Payment method screen – Your hosted checkout page
* Google Pay API payment screen – The Google Pay payment sheet (shown after clicking the GPay button)
* Post-purchase screen – Transaction confirmation page
* Submit the screenshots, indicate that you have submitted the request, and share the merchantId (BCR)

Use the assigned Merchant ID to configure the Google Pay connection in the WHITELABEL dashboard.

## Integration

To integrate Google Pay with WHITELABEL, follow these steps:

1. In the [WHITELABEL dashboard](https://dashboard.whitelabel.com/), go to the Connections tab. Find Google Pay and click Connect. Enter your credentials in the side panel. Choose a name for the connection and use the merchant ID obtained from the [Google Pay Business Console](https://pay.google.com/business/console) in the Merchant ID field.

<Frame><img src="/images/reference/google-pay-direct-integration/image1.png" /></Frame>

2. Create a route in WHITELABEL's dashboard using the processor you want for Google Pay payments. See the [Configure dynamic routing](/docs/routing#configuring-the-dynamic-routing) guide for more information.

WHITELABEL processes the payment token received from Google Pay through your configured payment processor. Google Pay transactions appear in your WHITELABEL dashboard alongside your other payment methods.

## Enable and test Google Pay with WHITELABEL

After integrating, you can enable and test Google Pay with WHITELABEL as follows:

1. Create a Google Wallet Test Account:
   * Visit the [Google Wallet Test Account Sign-In](https://accounts.google.com/InteractiveLogin/signinchooser?continue=https%3A%2F%2Fpay.google.com%2Fbusiness%2Fconsole%2F\&followup=https%3A%2F%2Fpay.google.com%2Fbusiness%2Fconsole%2F\&osid=1\&passive=1209600\&ifkv=AeDOFXjl_LLJZyuykU06uleha4p7uSXJNnLCv_n2jshX6QVJYCy9AKq3K28mIfpgyfS2NDHfimnAFg\&flowName=GlifWebSignIn\&flowEntry=ServiceLogin) page.
   * If you do not have a Google account, create one to proceed.
   * Once signed in, you will be redirected to the Google Wallet business console.
2. Access the Google Wallet API Section:
   * In the Google Wallet business console, navigate to the API management or integration section (usually under developer or integration settings).
3. Select **Create a Pass** to enable **Demo Mode**:
   * In the Google Wallet API section, find the option labeled **Create a Pass**.
   * Click this option to enable **Demo mode**. This allows you to simulate and test pass creation and interactions without real transactions.

<Frame><img src="/images/reference/google-pay-direct-integration/image2.png" /></Frame>

4. Download the [Google Wallet App](https://play.google.com/store/apps/details?id=com.google.android.apps.walletnfcrel\&hl=en\&gl=US) from the Play Store.
5. Go through the payment flow to test the integration.

By following these steps, you can ensure Google Pay is integrated and working as expected before making it available to your customers.

## Go live

After completing all integration steps in the testing environment, request [Google Production Access](https://developers.google.com/pay/api/web/guides/test-and-deploy/request-prod-access) and contact your Technical Account Manager. The WHITELABEL team will help verify your configuration and confirm you are ready to go live.

## Implementation details

Key details for your Google Pay integration with WHITELABEL:

### Google Pay API authorization methods

WHITELABEL supports both Google Pay API authorization methods:

* **`PAN_ONLY`**: Card credentials stored in the user's Google account. When used, WHITELABEL automatically handles 3D Secure authentication if enabled.
* **`CRYPTOGRAM_3DS`**: Device-based card credentials with built-in authentication. These credentials include cryptographic authentication and don't require additional 3DS processing. These credentials decrypt to a device-specific number (DPAN), so see [Card last four digits for device tokens](#card-last-four-digits-for-device-tokens) if you display the card's last four digits to the cardholder.

Both methods are supported globally across all countries where WHITELABEL operates. On the frontend, include both `PAN_ONLY` and `CRYPTOGRAM_3DS` in your `allowedAuthMethods` array for maximum payment success rates.

* **3D Secure (3DS) for`PAN_ONLY` credentials**: If Google Pay returns a `PAN_ONLY` credential (a card stored in the user's Google account), WHITELABEL will automatically handle the 3D Secure authentication flow if 3DS is enabled. On the frontend, make sure your Google Pay API request includes `PAN_ONLY` in the `allowedAuthMethods` array.
* **Gateway and GatewayMerchantID configuration**: When registering with the [Google Pay Business Console](https://pay.google.com/business/console), ensure that under **Google Pay API** > **Integrate with your website**, the **Integration type** is set to **GATEWAY**. The `Merchant ID` from the Google Pay Business Console is used in the "Merchant ID" field when setting up the Google Pay connection in the WHITELABEL dashboard. Set `gateway` to `whitelabel` and use your assigned Merchant ID as the `gatewayMerchantId` in your Google Pay API configuration.
* **Authorization methods**: WHITELABEL supports standard authorization methods (purchase, authorization, capture). Availability depends on the payment processor and acquiring bank for each country and payment.
* **Billing address requirements**: If your payment processing requires the customer's billing address (for example, for AVS checks), configure this in your Google Pay API request. Google provides `BillingAddressParameters` to specify the required detail (for example, MIN or FULL). See [Google's documentation](https://developers.google.com/pay/api/web/reference/request-objects#BillingAddressParameters). Only request billing address details if necessary, as this can increase checkout friction.
* **Transaction data and payment cryptography**: Merchants integrate WHITELABEL's SDKs (Android, iOS, Web) into their applications. When a customer chooses Google Pay, WHITELABEL's SDK interacts with the Google Pay API and securely receives the encrypted payment data (payment token) from Google. This token is passed from your app to your backend server, which then uses WHITELABEL's server-side APIs to submit the token for payment processing. WHITELABEL handles decryption and processing with the payment processor.

## Pass Google Pay payment token in request

<Warning>
  **Important: ECv2 Protocol Version Required (Android SDK v2.8.0+)**

  Starting from WHITELABEL Android SDK version 2.8.0, only Google Pay's ECv2 (Encrypted Card Version 2) protocol is supported. If your Google Pay integration is configured to use ECv1, payments will not be processed correctly.

  Please ensure your Google Pay API configuration includes `"protocolVersion": "ECv2"` in the tokenization specification. ECv1 has been deprecated by Google and is no longer supported by WHITELABEL's SDK.

  If you are upgrading from a version prior to 2.8.0 or migrating from a custom SDK build, verify that your Google Pay merchant configuration uses ECv2 before processing payments. For guidance on updating your Google Pay configuration, refer to [Google's documentation](https://developers.google.com/pay/api/android/guides/resources/payment-data-cryptography#encrypted-card-version).
</Warning>

When you initiate a transaction with Google Pay, a payment token containing encrypted payment data is returned. Pass the complete token received from Google Pay in the `payment_method.detail.wallet.payment_token` field as a JSON string in your payment request.

### Google Pay wallet response object

The Google Pay SDK returns the following object structure, which must be passed as the complete `payment_token` value:

```json
{
  "signature": "MEQCIBvkZdkroLuBAj0K0yhqF4RfvkcWM8hW4nInpGnbSbqHAiA4emX0LkHkdnYqIiGgAQ+gF2Md5ac1DIsHItwJfwj9DQ==",
  "intermediateSigningKey": {
    "signedKey": "{\"keyValue\":\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEZ8tVNZqE1G6292tV11Ff1Pc1xZDZU9Mj5QSqDaU9hMjaH+CYI7+XL+Cor0X+4r0jICgcZgQkS/q+WzY8Eku1Fg==\",\"keyExpiration\":\"1766083480615\"}",
    "signatures": [
      "MEYCIQC75wFVZ3JkWTZenVvU9WVdWzeKUvTiB2FAGtUjIP6qFgIhAP3nB97NF+2lXsqpflH/livwpy24IPSfWMF7i1pHqrw1"
    ]
  },
  "protocolVersion": "ECv2",
  "signedMessage": "{\n  \"encryptedMessage\": \"Fvw/m1KNUIAXRRd6gbbuH2eWEhARKpQL/WZBJF5GCWE9QTuJf15pJUASEIjooQa36AwbGuSUs5qtm36x/yWe8pGi4w2vNyN+bUcnw4HuxrhrPMD+VoioLwmJenHU7/ypW5wzGfOmaCWn3FQ8GjE59mfFtC+8+LPmt3Z9xcvr/wT4Qm09TNRp3k/4/6JaV2+OTYqeOER6pAvqb7WEEjRLjIapvAYKPE6VXrhIo5zdwGh2VWvxY000nkzEIbn3OKShJ/mT7ITLQF9b5J4caGGRVFBn2oobaO72I8CCpiTAWgsw3GnyQACk9ggqnXOugVWinFDDazcs0q2YF3x6fBjz8sJpODx1dTUPrOacvFzEJ9XPovYooYK3wDiRfrtwqoadG/SYlESoguIuuAx+XOdc1jP+NWy0WDVKIqAJOwsg5qkSvNS2qi3m7SKapX3EVLiw/619l9JpTIRHdiIIeOu5BtFYL86o4yb0plrE8/ivvQ2/7U4ISGxzaJ4o6PFk7RZ96nWafdT0m30JlxMmTOI6iUOtsw02SVtinwS+83xcN3s6XRAPWRjJ0d1kaUd/4kHbPy8S/UKNBjanytDwDzn6wEccluisI4E=\",\n  \"ephemeralPublicKey\": \"BPUzeogQZAp0N4D3vLYrvQ7Hc+fc261ZW17LIoMnIAgcWaANAhM39Z8mDCYxpiNIO/F0WtOkJhcvVZFSnI/yq/w=\",\n  \"tag\": \"owzrWByO1bNLbw9m/G2kzGmWDnBCs7QoMN+N0zovZAo=\"\n}"
}
```

### Request example

```json
{
  "account_id": "d34257e7-55d4-44cf-8b90-3a5152bbe020",
  "description": "Google Pay test",
  "merchant_order_id": "MER01",
  "country": "US",
  "amount": {
    "currency": "USD",
    "value": 1
  },
  "customer_payer": {
    "email": "testing@whitelabel.com"
  },
  "workflow": "DIRECT",
  "payment_method": {
    "detail": {
      "wallet": {
        "payment_token": "{\"signature\":\"MEQCIBvkZdkroLuBAj0K0yhqF4RfvkcWM8hW4nInpGnbSbqHAiA4emX0LkHkdnYqIiGgAQ+gF2Md5ac1DIsHItwJfwj9DQ\\u003d\\u003d\",\"intermediateSigningKey\":{\"signedKey\":\"{\\\"keyValue\\\":\\\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEZ8tVNZqE1G6292tV11Ff1Pc1xZDZU9Mj5QSqDaU9hMjaH+CYI7+XL+Cor0X+4r0jICgcZgQkS/q+WzY8Eku1Fg\\\\u003d\\\\u003d\\\",\\\"keyExpiration\\\":\\\"1766083480615\\\"}\",\"signatures\":[\"MEYCIQC75wFVZ3JkWTZenVvU9WVdWzeKUvTiB2FAGtUjIP6qFgIhAP3nB97NF+2lXsqpflH/livwpy24IPSfWMF7i1pHqrw1\"]},\"protocolVersion\":\"ECv2\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"Fvw/m1KNUIAXRRd6gbbuH2eWEhARKpQL/WZBJF5GCWE9QTuJf15pJUASEIjooQa36AwbGuSUs5qtm36x/yWe8pGi4w2vNyN+bUcnw4HuxrhrPMD+VoioLwmJenHU7/ypW5wzGfOmaCWn3FQ8GjE59mfFtC+8+LPmt3Z9xcvr/wT4Qm09TNRp3k/4/6JaV2+OTYqeOER6pAvqb7WEEjRLjIapvAYKPE6VXrhIo5zdwGh2VWvxY000nkzEIbn3OKShJ/mT7ITLQF9b5J4caGGRVFBn2oobaO72I8CCpiTAWgsw3GnyQACk9ggqnXOugVWinFDDazcs0q2YF3x6fBjz8sJpODx1dTUPrOacvFzEJ9XPovYooYK3wDiRfrtwqoadG/SYlESoguIuuAx+XOdc1jP+NWy0WDVKIqAJOwsg5qkSvNS2qi3m7SKapX3EVLiw/619l9JpTIRHdiIIeOu5BtFYL86o4yb0plrE8/ivvQ2/7U4ISGxzaJ4o6PFk7RZ96nWafdT0m30JlxMmTOI6iUOtsw02SVtinwS+83xcN3s6XRAPWRjJ0d1kaUd/4kHbPy8S/UKNBjanytDwDzn6wEccluisI4E\\\\u003d\\\",\\\"ephemeralPublicKey\\\":\\\"BPUzeogQZAp0N4D3vLYrvQ7Hc+fc261ZW17LIoMnIAgcWaANAhM39Z8mDCYxpiNIO/F0WtOkJhcvVZFSnI/yq/w\\\\u003d\\\",\\\"tag\\\":\\\"owzrWByO1bNLbw9m/G2kzGmWDnBCs7QoMN+N0zovZAo\\\\u003d\\\"}\"}"
      }
    },
    "type": "GOOGLE_PAY"
  }
}
```

## Recurring payments (CIT and MIT)

For recurring charges, vault the instrument on the first payment and charge the resulting `vaulted_token` afterwards. On the CIT, `payment_token` and `stored_credentials` sit together under `detail.wallet`. On the MIT, the instrument is a stored card, so `stored_credentials` moves to `detail.card`. The full `reason` and `usage` matrix is on [Stored credentials](/docs/payment-features/stored-credentials#wallet-originated-tokens-apple-pay-and-google-pay).

CIT, first payment with the Google Pay sheet shown:

```json
"payment_method": {
  "type": "GOOGLE_PAY",
  "vault_on_success": true,
  "detail": {
    "wallet": {
      "payment_token": "{\"protocolVersion\":\"ECv2\", ...}",
      "stored_credentials": {
        "reason": "SUBSCRIPTION",
        "usage": "FIRST"
      }
    }
  }
}
```

MIT, later charge on the vaulted instrument, no Google Pay token:

```json
"payment_method": {
  "type": "CARD",
  "vaulted_token": "vaulted-token-from-the-cit-response",
  "detail": {
    "card": {
      "stored_credentials": {
        "reason": "SUBSCRIPTION",
        "usage": "USED"
      }
    }
  }
}
```

`vault_on_success` requires `customer_payer.id`. `customer_payer.id` must reference an existing customer (create it first with [Create Customer](/reference/customers/create-customer)). Without it the payment still succeeds but nothing is vaulted: the response carries an empty `vaulted_token` and no error. The `vaulted_token` is returned only in the CIT payment response, so store it on your side. Do not place `stored_credentials` under `detail.card` on the CIT: it is not validated for a wallet payment and may be dropped, which leaves the saved record without stored-credential flags and without a `network_transaction_id`.

## Card last four digits for device tokens

When Google Pay returns a `CRYPTOGRAM_3DS` credential, the encrypted token decrypts to the **DPAN** — a device-specific number, not the card stored by the cardholder. Its last four digits are not the ones the cardholder recognizes, so `card_data.lfd` in the payment response is empty or shows the DPAN's last four.

The real card's last four digits are available to you in Google's response, outside the encrypted token:

```json
{
  "paymentMethodData": {
    "info": {
      "cardDetails": "1515",
      "cardNetwork": "VISA"
    },
    "tokenizationData": {
      "token": "..."
    }
  }
}
```

Send `paymentMethodData.info.cardDetails` as `payment_method.detail.wallet.card_data.lfd` and WHITELABEL uses it in place of the DPAN-derived value.

```json
{
  "payment_method": {
    "type": "GOOGLE_PAY",
    "detail": {
      "wallet": {
        "payment_token": "{\"protocolVersion\":\"ECv2\", ...}",
        "card_data": {
          "lfd": "1515"
        }
      }
    }
  }
}
```

| Field | Type | Required | Description |
| :---- | :--- | :------- | :---------- |
| `lfd` | string | No | Last four digits of the cardholder's real card, taken from `paymentMethodData.info.cardDetails`. Must be exactly 4 numeric digits. |

The field is optional and backward compatible. If you do not send it, behavior is unchanged.

* WHITELABEL applies the value only when the token is a device token — `auth_method` is `CRYPTOGRAM_3DS`, or `pan_type` is `DPAN` when `auth_method` is absent.
* `PAN_ONLY` credentials ignore the value. Those decrypt to the real card, so WHITELABEL keeps the decrypted last four.
* Only `lfd` is accepted. `brand` and the remaining card fields keep their decrypted values, because the DPAN's BIN already identifies the card network correctly.
* The value is ignored for other wallets, such as Apple Pay.

Once applied, the value appears in the create payment response, in the Get payment by ID response, and in payment webhooks, under `payment_method.detail.card.card_data.lfd`. Webhook payloads nest it under `payment_method_detail` instead of `detail`.

If `lfd` is present but is not exactly 4 numeric digits, the request is rejected:

```json
{
  "code": "INVALID_REQUEST",
  "messages": [
    "Invalid Request. payment_method.detail.wallet.card_data.lfd must be exactly 4 numeric digits."
  ]
}
```

## Related documentation

* [Google Pay overview](/docs/google-pay)
* [Google Pay SDK integration](/docs/google-pay-sdk-integration)
* [Google Pay via provider](/docs/integration-via-provider-google-pay)
* [Google Pay with PIX](/docs/google-pay-with-pix)