> For the complete documentation index, see [llms.txt](https://docs.verygoodsecurity.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.verygoodsecurity.com/cmp/payment-credentials/google-pay/create-card-google-pay-wallet-decryption.md).

# Create Card - Google Pay Wallet Decryption

#### Overview

CMP supports Google Pay Wallet Decryption, allowing merchants to submit an encrypted Google Pay payment token directly to CMP during card creation. CMP decrypts the token using VGS-managed encryption keys, extracts the DPAN or FPAN, creates and securely stores the card, and returns the card object and wallet metadata in the API response.

This feature is designed for merchants who have already obtained the encrypted Google Pay payment token from their checkout integration and want CMP to handle decryption and card creation.

The encrypted wallet token must be generated through the standard Google Pay payment flow before calling the Create Card API.

If you need guidance on generating encrypted Google Pay tokens for testing, see the [**Google Pay Wallet Decryption Testing Guide**](https://docs.verygoodsecurity.com/cmp/developer-resources/guides/testing/google-pay-decrypt).&#x20;

The `pan` field in the response contains the decrypted DPAN or FPAN. Tokenization behavior remains consistent with CMP: PCI-scoped clients receive both the PAN and PAN alias, while non-PCI clients receive only the PAN alias.

#### Benefits

* No need to build or maintain Google Pay decryption services.
* Reduced exposure to sensitive card information.
* VGS-managed encryption keys and key rotation.
* Standardized handling of Google Pay wallet metadata.
* Continued access to CMP vaulting and card fingerprinting.

#### Google Pay Wallet Decryption Flow

After the customer authorizes the payment using Google Pay, the encrypted payment token can be submitted to CMP for decryption and card creation.

**Flow Overview**

* The customer selects Google Pay during checkout.
* The merchant frontend initializes the Google Pay payment request.
* Google Pay displays the payment sheet, and the customer selects an eligible card.
* Google Pay returns an encrypted ECv2 payment token to the merchant frontend.
* The merchant backend receives the encrypted payment token.
* The merchant backend submits the encrypted Google Pay payload to CMP using the Create Card API.
* CMP verifies Google's signatures and decrypts the payment token using VGS-managed keys.
* CMP extracts the DPAN or FPAN and associated wallet details.
* CMP creates and securely stores the card.
* CMP returns the card object and applicable wallet metadata.

#### Setting Up Google Pay with VGS

To use Google Pay Wallet Decryption, VGS must enable the feature for the merchant's CMP account.

Unlike Apple Pay Wallet Decryption, merchants do not need to generate or upload payment processing certificates to VGS.

VGS manages the Google Pay gateway encryption keys for both sandbox and production environments.

**Google Pay Gateway Configuration**

Configure Google Pay with `PAYMENT_GATEWAY` tokenization and the VGS gateway parameters.

```json
{
  "type": "PAYMENT_GATEWAY",
  "parameters": {
    "gateway": "verygoodsecurity",
    "gatewayMerchantId": "<VGS_GENERATED_UUID>"
  }
}
```

| Parameter           | Description                                                                                  |
| ------------------- | -------------------------------------------------------------------------------------------- |
| `type`              | Must be `PAYMENT_GATEWAY`.                                                                   |
| `gateway`           | Must be `verygoodsecurity`.                                                                  |
| `gatewayMerchantId` | A unique identifier generated and provided by VGS for the merchant's Google Pay integration. |

The `gatewayMerchantId` is provided by VGS. It is not the Google-issued Merchant ID.

This identifier is used in the Google Pay configuration and is not sent as a separate field in the CMP Create Card request.

For additional setup information, see the [Google Pay API Tutorial](https://developers.google.com/pay/api/web/guides/tutorial).

**Google Pay Encryption Keys**

VGS manages the encryption keys required to decrypt Google Pay payment tokens.

* VGS creates separate encryption key pairs for sandbox and production.
* VGS securely stores the private keys and registers the corresponding public keys with Google.
* Google encrypts payment data using the registered gateway keys.
* VGS manages key rotation before the keys expire.

Merchants do not need to generate, store, exchange, or rotate these keys.

#### Generate an Encrypted Google Pay Payment Token

To receive an encrypted Google Pay token, the merchant must integrate the Google Pay API into the checkout experience.

A typical Google Pay payment flow includes:

* Initialize the Google Pay `PaymentsClient`.
* Configure the supported card networks and authentication methods.
* Configure `PAYMENT_GATEWAY` tokenization using the VGS gateway parameters.
* Display the Google Pay button.
* Call `loadPaymentData()` when the customer selects Google Pay.
* Receive the encrypted payment token from the Google Pay response.
* Send the payment token to the merchant backend for submission to CMP.

Google Pay returns the encrypted token in:

`paymentMethodData.tokenizationData.token`

The token contains the Google Pay ECv2 payment data required for decryption.

For detailed implementation instructions, refer to:

* [Google Pay API Tutorial](https://developers.google.com/pay/api/web/guides/tutorial)
* [Google Pay API Request Objects](https://developers.google.com/pay/api/web/reference/request-objects)

#### Create Card Request

To use Google Pay Wallet Decryption, create a service account with the required card access scopes and generate a JWT access token. CMP uses ECDH with its recipient private key and `ephemeralPublicKey`, then HKDF to derive the keys. It verifies the HMAC tag and decrypts `encryptedMessage` using AES.

Use this token to authenticate the [Create Card API](https://docs.verygoodsecurity.com/cmp/developer-resources/api/cards) request, submitting the encrypted Google Pay payment token instead of a decrypted PAN.

**Endpoint:** `POST /cards`

**Content-Type:** `application/vnd.api+json`

**Authentication:** Bearer token

Submit the encrypted Google Pay ECv2 fields under `data.attributes.encrypted_payment_data`.

#### **Google Pay Token to CMP Field Mapping**

When constructing the Create Card request, map the fields from Google's `paymentMethodData.tokenizationData.token` as follows:

| Google Pay token field              | CMP API field                       | Description                                                             |
| ----------------------------------- | ----------------------------------- | ----------------------------------------------------------------------- |
| —                                   | `wallet_type`                       | Set to `google_pay`.                                                    |
| `protocolVersion`                   | `protocolVersion`                   | Must be `ECv2`.                                                         |
| `signature`                         | `signature`                         | Google Pay payment token signature.                                     |
| `intermediateSigningKey.signedKey`  | `intermediateSigningKey.signedKey`  | Serialized JSON string containing the intermediate signing key details. |
| `intermediateSigningKey.signatures` | `intermediateSigningKey.signatures` | Array of intermediate signing key signatures.                           |
| `signedMessage`                     | `signedMessage`                     | Serialized JSON string containing the encrypted payment data.           |
| `paymentMethodData.info`            | `payment_method`                    | Optional payment method details mapped to CMP's supported fields.       |

**Important:** The `signedKey` and `signedMessage` values must be sent exactly as received from Google Pay. Do not modify or reserialize these strings.

**Example Format of thCreate Card Request Format**

```json
{
  "data": {
    "attributes": {
      "encrypted_payment_data": {
        "wallet_type": "google_pay",
        "signature": "<GOOGLE_PAY_SIGNATURE>",
        "intermediateSigningKey": {
          "signedKey": "{\"keyValue\":\"<KEY_VALUE>\",\"keyExpiration\":\"<KEY_EXPIRATION>\"}",
          "signatures": [
            "<INTERMEDIATE_SIGNING_KEY_SIGNATURE>"
          ]
        },
        "protocolVersion": "ECv2",
        "signedMessage": "{\"encryptedMessage\":\"<ENCRYPTED_MESSAGE>\",\"ephemeralPublicKey\":\"<EPHEMERAL_PUBLIC_KEY>\",\"tag\":\"<TAG>\"}",
        "payment_method": {
          "display_name": "Visa •••• 1111",
          "network": "VISA",
          "type": "DEBIT"
        }
      }
    }
  }
}
```

The request above illustrates the field structure. Replace the placeholders with the complete encrypted values received from Google Pay.

The `signedKey` and `signedMessage` fields are serialized JSON strings, not nested JSON objects.

If `payment_method` is included, all three fields (`display_name`, `network`, and `type`) must be provided.

**Supported Encryption Version**

CMP supports Google Pay payment tokens using the `ECv2` encryption protocol.

#### Create Card Response

After successful decryption, CMP returns a card object containing the decrypted DPAN or PAN and associated Google Pay wallet metadata.&#x20;

The response includes applicable fields such as:

* `wallet_type`
* `token_type`
* `pan_alias`
* `wallet_details.payment_data_type`
* `wallet_details.auth_method`
* `wallet_details.message_id`
* `wallet_details.cryptogram` for DPAN transactions
* `wallet_details.payment_method`, if provided in the request
* Card attributes and fingerprint information
* `eciIndicator` is optional. The card network may include it in the decrypted Google Pay payment data for `CRYPTOGRAM_3DS` transactions. If present, pass it to your payment processor unchanged; omitting or altering it may cause the transaction to fail.

**Response Behavior**

* **201 Created:** A new card is created successfully.
* **Card classification:** DPAN cards return `token_type: dpan`, while `PAN_ONLY` transactions return `token_type: pan`.
* **PAN access:** Clients with the required PCI card-read permissions receive the clear PAN and PAN alias. Other clients receive only the PAN alias.
* `eciIndicator` is **optional**. The card network may include it in the decrypted Google Pay payment data for `CRYPTOGRAM_3DS` transactions. If present, pass it to your payment processor unchanged; omitting or altering it may cause the transaction to fail.
* **Synchronous response:** Google Pay Wallet Decryption uses a synchronous request-response flow. When you submit an encrypted Google Pay token to the Create Card API, CMP processes the request and returns the created card object directly in the API response.
* **No webhook notifications are sent for this flow.** Customers should expect the result in the synchronous Create Card response only. The Create Card response contains all card data and wallet metadata immediately upon successful decryption and card creation.
* [**Card Attributes**](https://docs.verygoodsecurity.com/cmp/products-and-services/card-attributes)**:** If Card Attributes is enabled for the tenant, the Create Card response also includes advanced card attributes.

**DPAN Response — CRYPTOGRAM\_3DS**

For DPAN transactions, CMP returns the card details along with a single-use cryptogram for payment authorization.

The following example shows selected fields from `data.attributes`:

```json
{
  "token_type": "dpan",
  "wallet_type": "google_pay",
  "wallet_details": {
    "payment_data_type": "3DSecure",
    "auth_method": "CRYPTOGRAM_3DS",
    "message_id": "<MESSAGE_ID>",
    "cryptogram": {
      "type": "TAVV",
      "value": "<CRYPTOGRAM_VALUE>",
      "eci": "07"
    },
    "payment_method": {
      "display_name": "Visa •••• 1111",
      "network": "VISA",
      "type": "DEBIT"
    }
  }
}
```

The cryptogram type and ECI depend on the card network and payment data. The values above are illustrative.

**PAN Response — PAN\_ONLY**

For `PAN_ONLY` transactions, CMP returns the card details without a cryptogram.

The following example shows selected fields from `data.attributes`:

```json
{
  "token_type": "pan",
  "wallet_type": "google_pay",
  "wallet_details": {
    "payment_data_type": "PAN_ONLY",
    "auth_method": "PAN_ONLY",
    "message_id": "<MESSAGE_ID>",
    "payment_method": {
      "display_name": "Visa •••• 1111",
      "network": "VISA",
      "type": "DEBIT"
    }
  }
}
```

No cryptogram is returned for `PAN_ONLY` transactions.

#### Cryptogram Handling

For DPAN transactions, the Create Card response includes the payment cryptogram returned by Google Pay.

Cryptogram behavior:

* The cryptogram is single-use.
* It is intended for the current payment authorization.
* It must be passed to the payment processor together with the required authorization data.
* It cannot be reused for another payment.
* It is not stored by CMP.

**The ECI indicator is optional and is returned when provided by Google Pay and supported by the card network.**

<table data-search="false"><thead><tr><th width="146.4140625">Wallet</th><th width="113.8046875">Network</th><th width="92.3203125">ECI value</th><th width="215.0546875">Authentication / liability meaning</th><th>What it means when passed to processor</th></tr></thead><tbody><tr><td>Google Pay</td><td>Visa</td><td><code>05</code></td><td>Authenticated device token transaction (<code>CRYPTOGRAM_3DS</code>). Card issuer is the liable party.</td><td>Pass <code>eciIndicator</code> to the processor unchanged.</td></tr><tr><td>Google Pay</td><td>Visa</td><td><code>07</code></td><td>Device token transaction (<code>CRYPTOGRAM_3DS</code>). Merchant/acquirer is the liable party.</td><td>Pass <code>eciIndicator</code> to the processor unchanged.</td></tr><tr><td>Google Pay</td><td>Mastercard</td><td><code>02</code></td><td>Authenticated device token transaction (<code>CRYPTOGRAM_3DS</code>). Card issuer is the liable party.</td><td>Pass <code>eciIndicator</code> to the processor unchanged.</td></tr><tr><td>Google Pay</td><td>Mastercard</td><td><code>06</code></td><td>Device token transaction (<code>CRYPTOGRAM_3DS</code>). Merchant/acquirer is the liable party.</td><td>Pass <code>eciIndicator</code> to the processor unchanged.</td></tr><tr><td>Google Pay</td><td>Mastercard</td><td>Empty</td><td>Device token transaction (<code>CRYPTOGRAM_3DS</code>). Merchant/acquirer is the liable party.</td><td>No ECI value to send. Do not substitute or hardcode one.</td></tr><tr><td>Google Pay</td><td>Other networks</td><td>Empty</td><td>Device token transaction (<code>CRYPTOGRAM_3DS</code>). Merchant/acquirer is the liable party.</td><td>No ECI value to send. Do not substitute or hardcode one.</td></tr><tr><td>Google Pay</td><td>Any</td><td>Not present</td><td><code>PAN_ONLY</code> transaction. There is no cryptogram and no <code>eciIndicator</code>.</td><td>Nothing to pass.</td></tr></tbody></table>

`eciIndicator` is returned only for authenticated device token transactions (`CRYPTOGRAM_3DS`), and not always even then. Google says the value must be passed down the payment processing flow.

#### Retrieve Card — GET /cards/{id}

After card creation, merchants can retrieve the stored Google Pay card using the standard [Get Card API](https://docs.verygoodsecurity.com/cmp/developer-resources/api/cards#get-cards-card_id). The response includes the stored card details and applicable Google Pay wallet metadata.

If [Card Attributes](https://docs.verygoodsecurity.com/cmp/products-and-services/card-attributes) is enabled for the tenant, the GET Card response also includes advanced card attributes.

**Important:** The cryptogram and its ECI are single-use and are not stored or returned by the Get Card API.

Merchants must use the cryptogram from the current Create Card response for the corresponding payment authorization.

#### **Understanding `last4` for Google Pay cards**

**Important:** The `last4` returned by CMP is derived from the `pan` field in the decrypted Google Pay payload. What that field holds depends on the `authMethod`, so `last4` does not always identify the underlying funding card.

* **`CRYPTOGRAM_3DS`:** `pan` contains the device-specific token (DPAN), so `last4` contains the last four digits of the DPAN. It does not contain the last four digits of the underlying funding PAN (FPAN).
* **`PAN_ONLY`:** `pan` contains the FPAN, so `last4` contains the last four digits of the FPAN.

Because the same field can hold either value, consumers must not assume `last4` matches the card the customer sees in their Google Wallet. Check the auth method before treating `last4` as the funding card’s last four digits.

Google separately provides `paymentMethodData` alongside the encrypted token. It can contain:

* `description`: a user-facing description of the payment method, such as `Visa •••• 1234`. Google recommends this field for customer-facing displa&#x79;**.**
* `info.cardNetwork`
* `info.cardDetails`
* `info.cardFundingSource`: `CREDIT`, `DEBIT`, `PREPAID`, or `UNKNOWN`

Google describes `cardDetails` as commonly the last four digits of the card, but does not guarantee its content. CMP recommends that applications not use `cardDetails` for authorization, card matching, deduplication, or reconciliatio&#x6E;**.** `description` can be used as an optional label to help customers recognize a payment method.

If the authoritative last four digits of the backing FPAN are required, you must be obtained from another approved source outside the Wallet Decrypt response.

See Google’s [`PaymentMethodData` / `CardInfo`](https://developers.google.com/pay/api/web/reference/response-objects) documentation.

#### Validation and Error Handling

CMP performs the following checks when processing the encrypted Google Pay payment token:

* Verifies the JWT and access to the requested account and environment.
* Verifies that  CMP received the Create Card request in the accepted format.
* Confirms that Google Pay Wallet Decryption is enabled.
* Validates the request fields and ECv2 format.
* Verifies the Google Pay signatures and checks the intermediate signing key expiration.
  * **Verify the intermediate signing key:** CMP checks the signatures in `intermediateSigningKey` against Google’s root signing keys for the relevant environment. It rejects the payload if the key has expired.
  * **Verify the message signature.** CMP checks the signature using the intermediate key and the length-prefixed concatenation of `"Google"`, the recipient ID, `"ECv2"`, and `signedMessage`. Including the recipient ID ensures that a token created for a different gateway fails verification.
* Checks payment token integrity and expiration.
* Verifies that the token corresponds to the configured gateway merchant identifier.

If validation or decryption fails, CMP rejects the request.

#### Limitations

Cards created using **Google Pay Wallet Decryption** currently have the following limitations:

* **Duplicate Card Detection:** Duplicate card detection is **not supported** for encrypted Google Pay tokens. Each Create Card request creates a new card object with a unique `card_id`, even if the same card was previously stored.
* **Network Tokens (NT):** Not supported for cards created using Google Pay DPAN tokens.
* **Account Updater (AU):** Not supported for cards created using Google Pay DPAN tokens.
* **3D Secure (3DS):** Not currently supported for cards created using Google Pay DPAN tokens.

#### Scopes:

The service account requires the `cards:create` scope to create cards and `cards:read` to retrieve them. The `cards:update` scope allows updating existing cards, while `cards:delete` allows deleting them.

#### Cryptogram handling

For DPAN flows, the Create Card response can include the cryptogram and ECI when they are present in the Google Pay payment data. Non-PCI clients receive the PAN alias instead of the clear DPAN. The cryptogram and ECI are not stored and are not returned in GET Card responses.

#### Using the PAN alias with the outbound proxy

The PAN alias represents the stored DPAN. You can use it with the outbound proxy to reveal the DPAN, using the same approach as for a card alias created through VGS Collect and your existing routes.

#### Testing Google Pay Wallet Decryption

For mock testing, sandbox testing, and production setup, refer to the [**Google Pay Wallet Decryption Testing Guide**](https://docs.verygoodsecurity.com/cmp/developer-resources/guides/testing/google-pay-decrypt).&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.verygoodsecurity.com/cmp/payment-credentials/google-pay/create-card-google-pay-wallet-decryption.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
