# Google Pay UCP Code Generator

> [!WARNING]
> **Beta:** This tool is in development.

The UCP Code Generator lets you quickly customize, validate, and generate
the JSON configuration required for the Google Pay payment handler under the
Universal Commerce Protocol (UCP).

## How to use this tool

- Clicking on the arrow to the right of an object label will open it for editing, or close it if it's already open.
- Clicking on the ⓘ icon to the left of an object label will open documentation for that parameter.
- Clicking on an optional field's label (rendered in dark gray) enables or disables it. Disabled fields are grayed out, collapsed, and excluded from the generated configuration. Editing a disabled field or selecting a value automatically re-enables it.
- Clicking the **delete** button next to array elements or after complex objects will remove that item from the list.
- Multi-select fields will let you select multiple entries at the same time. Click an option to select or deselect it, and control or command-click to deselect all other options.
- As you edit parameters, the configuration JSON will automatically update based on your settings, and notify you when a configuration is known to be invalid.

> [!NOTE]
> **Note:** Required fields are marked by a star `*`. Fields with extra information are marked with a question mark `?` icon.

TEST PROD
- Gateway
- Direct
<button class="config-action-btn custom-preset-btn primary-btn">Manage Presets</button> <button class="config-action-btn jsfiddle-btn hidden">Open in JSFiddle</button>

```

```
*Tip: Click any optional field label (underlined on hover) to enable or disable it from the JSON.*

## Configuration JSON

```json

```
{ "payment_handlers": { "meta_type": "object", "meta_required": true, "meta_documentation": "https://developers.google.com/pay/api/universal-commerce-protocol/reference/config", "com.google.pay": \[ { "meta_type": "object", "meta_required": true, "meta_documentation": "https://developers.google.com/pay/api/universal-commerce-protocol/reference/config", "meta_addButtonText": "Add payment handler", "id": { "meta_type": "text", "meta_required": true, "meta_hoverText": "A unique identifier for this handler configuration instance (typically a UUIDv4)." }, "version": { "meta_type": "text", "meta_required": true, "meta_editable": false }, "spec": { "meta_type": "text", "meta_required": true, "meta_editable": false }, "schema": { "meta_type": "text", "meta_required": true, "meta_editable": false }, "config": { "meta_type": "object", "meta_required": true, "meta_documentation": "https://pay.google.com/gp/p/ucp/2026-01-23/schemas/config.json", "api_version": { "meta_type": "number", "meta_required": true, "meta_editable": false, "meta_hoverText": "The major Google Pay API version. Currently, this must be 2." }, "api_version_minor": { "meta_type": "number", "meta_required": true, "meta_editable": false, "meta_hoverText": "The minor Google Pay API version. Currently, this must be 0." }, "environment": { "meta_type": "select", "meta_required": true, "meta_options": \["TEST", "PRODUCTION"\], "meta_hoverText": "The Google Pay environment." }, "merchant_info": { "meta_type": "object", "meta_required": true, "meta_documentation": "https://developers.google.com/pay/api/web/reference/request-objects#MerchantInfo", "meta_hoverText": "Identity details for the merchant as required by the Google Pay UCP handler.", "merchant_name": { "meta_type": "text", "meta_hoverText": "The user-facing name of the merchant that will appear on the Google Pay payment sheet." }, "merchant_id": { "meta_type": "text", "meta_required": true, "meta_hoverText": "The Google Pay Merchant ID. Use a dummy value or 'TEST' for the TEST environment as configured in the handler configuration; use the real Merchant ID for PRODUCTION." }, "merchant_origin": { "meta_type": "text", "meta_hoverText": "The fully qualified domain name where the checkout occurs." }, "auth_jwt": { "meta_type": "text", "meta_hoverText": "An optional authorization JWT for certain integration contexts." } }, "allowed_payment_methods": \[ { "meta_type": "object", "meta_required": true, "meta_documentation": "https://developers.google.com/pay/api/web/reference/request-objects#PaymentMethod", "meta_hoverText": "Configuration options for an allowed payment method and its tokenization or processing specifications.", "meta_addButtonText": "Add payment method", "type": { "meta_type": "select", "meta_required": true, "meta_options": \["CARD"\], "meta_hoverText": "An identifier for the type of supported payment method. CARD is the only supported value." }, "parameters": { "meta_type": "object", "meta_required": true, "meta_documentation": "https://developers.google.com/pay/api/web/reference/request-objects#CardParameters", "meta_hoverText": "Parameters required to configure the provided payment method type. For the CARD type use CardParameters.", "allowed_auth_methods": { "meta_type": "select", "meta_required": true, "meta_multiple": true, "meta_options": \["PAN_ONLY"\], "meta_hoverText": "Fields supported to authenticate a card transaction. PAN_ONLY returns PAN and expiration for cards on file with the user's Google Account." }, "allowed_card_networks": { "meta_type": "select", "meta_required": true, "meta_multiple": true, "meta_options": \[ "AMEX", "DISCOVER", "ELECTRON", "ELO", "ELO_DEBIT", "INTERAC", "JCB", "MAESTRO", "MASTERCARD", "VISA" \], "meta_hoverText": "The card networks supported by the merchant and the Google Pay API." }, "allow_prepaid_cards": { "meta_type": "checkbox", "meta_hoverText": "Set to false if you don't support prepaid cards. Default is true." }, "allow_credit_cards": { "meta_type": "checkbox", "meta_hoverText": "Set to false if you don't support credit cards. Default is true." }, "billing_address_required": { "meta_type": "checkbox", "meta_hoverText": "Set to true if you require a billing address." }, "billing_address_parameters": { "meta_type": "object", "meta_documentation": "https://developers.google.com/pay/api/web/reference/request-objects#BillingAddressParameters", "meta_hoverText": "The expected fields returned if billing_address_required is set to true.", "format": { "meta_type": "select", "meta_options": \["MIN", "FULL", "FULL-ISO3166"\], "meta_hoverText": "Billing address format required to complete the transaction." }, "phone_number_required": { "meta_type": "checkbox", "meta_hoverText": "Set to true if a phone number is required to process the transaction." } } }, "tokenization_specification": { "meta_type": "object", "meta_required": true, "meta_documentation": "https://developers.google.com/pay/api/web/reference/request-objects#PaymentMethodTokenizationSpecification", "meta_hoverText": "Configure an account or decryption provider to receive payment information. This property is required for the CARD payment method.", "type": { "meta_type": "select", "meta_required": true, "meta_options": \["PAYMENT_GATEWAY", "DIRECT"\], "meta_hide_children": { "PAYMENT_GATEWAY": \["parameters.protocolVersion", "parameters.publicKey"\], "DIRECT": \["parameters.gateway", "parameters.gatewayMerchantId"\] }, "meta_hoverText": "A payment method tokenization type is supported for the given PaymentMethod. For the CARD payment method, use PAYMENT_GATEWAY or DIRECT." }, "parameters": { "meta_type": "object", "meta_hoverText": "Parameters specific to the selected payment method tokenization type.", "gateway": { "meta_type": "text", "meta_documentation": "https://developers.google.com/pay/api/web/guides/tutorial#tokenization" }, "gatewayMerchantId": { "meta_type": "text" }, "protocolVersion": { "meta_type": "text" }, "publicKey": { "meta_type": "text" } } } } \] } } \] } } { "payment_handlers": { "com.google.pay": \[ { "id": "8c9202bd-63cc-4241-8d24-d57ce69ea31c", "version": "2026-01-23", "spec": "https://pay.google.com/gp/p/ucp/2026-01-23/", "schema": "https://pay.google.com/gp/p/ucp/2026-01-23/schemas/config.json", "config": { "api_version": 2, "api_version_minor": 0, "environment": "TEST", "merchant_info": { "merchant_name": "Example Merchant", "merchant_id": "KWMZPRLQFTYNXSDB", "merchant_origin": "checkout.merchant.com" }, "allowed_payment_methods": \[ { "type": "CARD", "parameters": { "allowed_auth_methods": \[ "PAN_ONLY", "CRYPTOGRAM_3DS" \], "allowed_card_networks": \[ "AMEX", "DISCOVER", "JCB", "MASTERCARD", "VISA" \] }, "tokenization_specification": { "type": "PAYMENT_GATEWAY", "parameters": { "gateway": "example", "gatewayMerchantId": "exampleGatewayMerchantId" } } } \] } } \] } } { "payment_handlers": { "com.google.pay": \[ { "id": "8c9202bd-63cc-4241-8d24-d57ce69ea31c", "version": "2026-01-23", "spec": "https://pay.google.com/gp/p/ucp/2026-01-23/", "schema": "https://pay.google.com/gp/p/ucp/2026-01-23/schemas/config.json", "config": { "api_version": 2, "api_version_minor": 0, "environment": "TEST", "merchant_info": { "merchant_name": "Example Merchant", "merchant_id": "KWMZPRLQFTYNXSDB", "merchant_origin": "checkout.merchant.com" }, "allowed_payment_methods": \[ { "type": "CARD", "parameters": { "allowed_auth_methods": \[ "PAN_ONLY", "CRYPTOGRAM_3DS" \], "allowed_card_networks": \[ "AMEX", "DISCOVER", "JCB", "MASTERCARD", "VISA" \] }, "tokenization_specification": { "type": "DIRECT", "parameters": { "protocolVersion": "ECv2", "publicKey": "BOdoXP+96CFr24tD6MRHJgdqbhxlV79Sp4t8jiFHgZT71nJIHPM+/REv7b1V5A52u1WjC4m6Z4wG4/k7g8A=" } } } \] } } \] } } ×

### Manage Presets

<button class="config-action-btn save-preset-btn primary-btn">Save Configuration</button>

### Unsaved Changes

You have unsaved changes. Are you sure you want to load this preset and lose your changes?
<button class="config-action-btn cancel-confirm-btn">Cancel</button> <button class="config-action-btn proceed-confirm-btn primary-btn">Discard Changes</button>