> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Wix Payments Handler for UCP

## Article: Wix Payments Handler for UCP

## Article Link: https://dev.wix.com/docs/api-reference/business-management/payments/agentic-commerce/universal-commerce-protocol/wix-payments-handler-for-ucp.md

## Article Content:

# Accept Card Payments with the Wix Payments Handler for UCP

Use the `com.wix.payments` handler to accept card payments from buyers on Wix sites through your [Universal Commerce Protocol](https://ucp.dev) (UCP) compatible platform. The handler follows the UCP [processor-tokenizer pattern](https://ucp.dev/2026-08-25/specification/payment/examples/processor-tokenizer-payment-handler/). Your platform sends raw card data to a Wix-hosted tokenize URL and receives an opaque token, which it submits to the merchant's checkout.

In UCP terms, your platform is the agent or application acting for the buyer, and the business is the Wix merchant, identified by its Wix site ID.

## How it works

To accept a card payment, follow these steps:

1. **Discover the handler:** Read the business's UCP profile at `/.well-known/ucp`, which advertises the handler under `net.wixapps.ucp.payments`.
1. **Get the handler from the checkout:** Create the checkout. Its response carries the authoritative handler copy for that checkout, with the instruments narrowed to what this checkout accepts.
1. **Tokenize the card:** Collect card details in your PCI-compliant credential provider and call `POST {config.token_url}`. The response contains an opaque token bound to the checkout and the business.
1. **Complete the checkout:** Submit the token in the business's Complete Checkout call, with `handler_id` set to the `id` of the handler instance from the checkout. The token is resolved and the card is charged.

## Supported instruments

The handler supports the `card` instrument type for Visa, Mastercard, American Express, and Discover cards. Every card must be tokenized before checkout. Wallets such as Apple Pay and Google Pay, and other payment methods, aren't supported.

## Step 1 | Discover the handler

Request the business profile at `/.well-known/ucp`. The profile declares the handler, which validates against `business_schema` in the [UCP payment handler schema](https://ucp.dev/2026-08-25/schemas/payment_handler.json).

A handler entry has the following identifiers, which differ from each other:

| Field | Value | Meaning |
|---|---|---|
| `payment_handlers` key | `net.wixapps.ucp.payments` | The handler's reverse-domain name. It's bound to the domain that hosts `schema`. |
| `id` | `com.wix.payments` | The handler instance ID. Use it as `handler_id` in Complete Checkout. |
| `version` | `2026-04-08` | The handler's own contract version. It's independent of `ucp.version`. |

The following example shows a request for the main profile, which uses UCP version `2026-08-25`:

```http
GET https://{merchant-domain}/.well-known/ucp
```

The response includes the handler entry:

```http
HTTP/1.1 200 OK

{
  "ucp": {
    "version": "2026-08-25",
    "payment_handlers": {
      "net.wixapps.ucp.payments": [
        {
          "id": "com.wix.payments",
          "version": "2026-04-08",
          "schema": "https://ucp.wixapps.net/payments/2026-04-08/schemas/schema.json",
          "available_instruments": [
            {
              "type": "card",
              "constraints": {
                "properties": {
                  "brand": { "enum": ["visa", "mastercard", "amex", "discover"] }
                }
              }
            }
          ],
          "config": {
            "business_id": "017faa3c-1d40-4862-94cd-68f10707329b",
            "token_url": "https://cashier-pci.wixapps.net/v1/ucp-tokens/2026-04-08/017faa3c-1d40-4862-94cd-68f10707329b/tokenize"
          }
        }
      ]
    }
  }
}
```

The profile for an older UCP version, at `/.well-known/ucp/2026-04-08`, uses the `2026-04-08` shape for `constraints`:

```json
"constraints": {
  "brands": ["visa", "mastercard", "amex", "discover"],
  "tokenization": "required"
}
```

### Handler configuration fields

The handler's `config` has the following fields:

| Field | Type | Required | Description |
|---|---|---|---|
| `business_id` | string | Yes | The Wix site ID that owns the checkout and the token |
| `token_url` | string (https URI) | Yes | The tokenize URL for this business, in the form `https://cashier-pci.wixapps.net/v1/ucp-tokens/{ucp_version}/{business_id}/tokenize`. The `ucp_version` segment is the UCP version of the tokenize request and response. It can differ from the profile's `ucp.version` |
| `environment` | string | No | The handler environment. When present, it's `production` |

## Step 2 | Get the handler from the checkout

Create a checkout. The response returns the same handler under `ucp.payment_handlers`. There, it validates against `response_schema` in the UCP payment handler schema. Its `available_instruments` is the intersection of the business declaration, your platform's declaration, and the cart. Use this copy of the handler for that checkout. In this example, the checkout accepts all the brands the profile advertises. The request body and the rest of the response body are omitted.

```http
POST /checkout-sessions
Content-Type: application/json
Idempotency-Key: 2f6c1b7e-9a4d-4c3e-8b52-7d1e0a9f6c34
UCP-Agent: profile="https://platform.example/.well-known/ucp"
```

The response includes the handler for this checkout:

```http
HTTP/1.1 201 Created

{
  "ucp": {
    "version": "2026-08-25",
    "status": "success",
    "payment_handlers": {
      "net.wixapps.ucp.payments": [
        {
          "id": "com.wix.payments",
          "version": "2026-04-08",
          "schema": "https://ucp.wixapps.net/payments/2026-04-08/schemas/schema.json",
          "available_instruments": [
            {
              "type": "card",
              "constraints": {
                "properties": {
                  "brand": { "enum": ["visa", "mastercard", "amex", "discover"] }
                }
              }
            }
          ],
          "config": {
            "business_id": "017faa3c-1d40-4862-94cd-68f10707329b",
            "token_url": "https://cashier-pci.wixapps.net/v1/ucp-tokens/2026-04-08/017faa3c-1d40-4862-94cd-68f10707329b/tokenize"
          }
        }
      ]
    }
  },
  "id": "b3c1e7a2-5f4d-4a8e-9c21-6d0f8e3a7b45",
  "status": "incomplete"
}
```

## Step 3 | Tokenize the card

Collect the card details in your PCI-compliant credential provider, then call the tokenize URL from the handler's `config`.

**URL:** `POST {config.token_url}`, for example `https://cashier-pci.wixapps.net/v1/ucp-tokens/2026-04-08/{business_id}/tokenize`. Call the URL from the config as given. Don't build it yourself. The version in the URL path sets the request and response format for the call. It can differ from the `ucp.version` of the profile or checkout that returned the URL.

**Authentication:** `Authorization: Bearer {access_token}`. The access token comes from the OAuth 2.0 client-credentials grant, using the client credentials Wix issues when the platform or agent is onboarded. Never put credentials in URLs or in agent-readable context.

**OpenAPI:** [Tokenization API](https://ucp.dev/2026-04-08/handlers/tokenization/openapi.json)

### Tokenize request

The following example shows a tokenize request:

```http
POST https://cashier-pci.wixapps.net/v1/ucp-tokens/2026-04-08/017faa3c-1d40-4862-94cd-68f10707329b/tokenize
Content-Type: application/json
Authorization: Bearer {access_token}

{
  "credential": {
    "type": "card",
    "card_number_type": "fpan",
    "number": "4111111111111111",
    "expiry_month": 12,
    "expiry_year": 2027,
    "cvc": "123",
    "name": "Jane Doe"
  },
  "binding": {
    "checkout_id": "b3c1e7a2-5f4d-4a8e-9c21-6d0f8e3a7b45"
  }
}
```

The request has the following fields:

| Field | Type | Required | Description |
|---|---|---|---|
| `credential.type` | string | Yes | Must be `card` |
| `credential.card_number_type` | string | Yes | Must be `fpan` |
| `credential.number` | string | Yes | Card number, 12 to 19 digits that pass the Luhn check |
| `credential.expiry_month` | integer | Yes | 1 to 12 |
| `credential.expiry_year` | integer | Yes | Four-digit year, 2000 to 2099. A year outside this range is rejected with `invalid_expiry_year`, and an expired card with `card_expired` |
| `credential.cvc` | string | No | 3 or 4 digits, when present |
| `credential.name` | string | Yes | Cardholder name, 1 to 200 characters |
| `binding.checkout_id` | string | Yes | The ID of the checkout the token is bound to, at most 500 characters |

These fields apply when the `token_url` path has `2026-04-08`. When the path has `2026-08-25`, the request differs in these ways:

- `credential.type` is `pan`.
- The credential has no `card_number_type`.
- The binding has `binding.type` and `binding.id` in place of `binding.checkout_id`. The value of `binding.type` is always `dev.ucp.shopping.checkout`.

The request doesn't accept `allowance`. Amount, currency, and token expiry come from the checkout and token state stored at Wix, not from your request.

### Tokenize response

The following example shows a successful tokenize response:

```http
HTTP/1.1 200 OK
Content-Type: application/json

{
  "token": "7c2e9f41-8d3a-4b6c-a1e5-0f9b3d7c2a86",
  "type": "token",
  "expires_at": "2027-01-15T10:15:00Z"
}
```

The response has the following fields:

| Field | Type | Description |
|---|---|---|
| `token` | string | Opaque token bound to the checkout and the business. The response doesn't include card data. |
| `type` | string | Token type. Always `token` |
| `expires_at` | string (ISO 8601) | When the token expires. After this time, tokenize the card again |

### Tokenize errors

A failed tokenize call returns an error code and a message:

```http
HTTP/1.1 422 Unprocessable Entity
Content-Type: application/json

{
  "code": "card_expired",
  "message": "The card has expired."
}
```

The following table lists the error codes:

| Code | HTTP status | Retryable |
|---|---|---|
| `invalid_request`, `unsupported_version`, `invalid_business_id`, `binding_required`, `binding_id_required`, `invalid_binding_id` | 400 | No. Fix the request. |
| `authentication_failed` | 401 | Yes, after refreshing the access token. |
| `forbidden` | 403 | No. Your platform isn't authorized to tokenize for this business. |
| `credential_required`, `card_number_type_required`, `invalid_card_number_type`, `card_number_required`, `invalid_card_number`, `expiry_month_required`, `invalid_expiry_month`, `expiry_year_required`, `invalid_expiry_year`, `card_expired`, `invalid_cvc`, `cardholder_name_required`, `invalid_cardholder_name` | 422 | Yes, with corrected or different card details. |
| `service_unavailable` | 503 | Yes, after backoff. |

These codes apply when the `token_url` path has `2026-04-08`. When the path has `2026-08-25`, the codes differ in these ways:

- The 400 errors also include `binding_type_required` and `invalid_binding_type`.
- The `card_number_type_required` and `invalid_card_number_type` errors aren't returned.

## Step 4 | Complete the checkout

Submit the token in the Complete Checkout request. The instrument validates against [`payment_instrument.json`](https://ucp.dev/2026-08-25/schemas/common/types/payment_instrument.json) and the credential against [`token_credential.json`](https://ucp.dev/2026-08-25/schemas/common/types/token_credential.json).

### Complete Checkout request

The following example shows a Complete Checkout request:

```http
POST /checkout-sessions/b3c1e7a2-5f4d-4a8e-9c21-6d0f8e3a7b45/complete
Content-Type: application/json
Idempotency-Key: 8d3f5a21-6c7b-4e90-a1d4-3b2c9e8f7a16
UCP-Agent: profile="https://platform.example/.well-known/ucp"

{
  "payment": {
    "instruments": [
      {
        "id": "4f8b2d19-7a3c-4e65-b0d2-8c1a5e9f3b70",
        "handler_id": "com.wix.payments",
        "type": "card",
        "selected": true,
        "display": {
          "brand": "visa",
          "last_digits": "1111",
          "expiry_month": 12,
          "expiry_year": 2027
        },
        "credential": {
          "type": "token",
          "token": "7c2e9f41-8d3a-4b6c-a1e5-0f9b3d7c2a86",
          "expires_at": "2027-01-15T10:15:00Z"
        }
      }
    ]
  },
  "signals": {
    "dev.ucp.buyer_ip": "203.0.113.42",
    "dev.ucp.user_agent": "Mozilla/5.0 ..."
  }
}
```

The payment instrument has the following fields:

| Field | Type | Description |
|---|---|---|
| `id` | string | Instrument ID that you assign, at most 100 characters |
| `handler_id` | string | The `id` of the handler instance from the checkout's `ucp.payment_handlers`, which is `com.wix.payments`. Copy it from the checkout response. Don't use the `payment_handlers` key. Any other value is rejected with `payment_requires_site_checkout` |
| `type` | string | Must be `card` |
| `selected` | boolean | Marks the instrument to charge |
| `display` | object | Card brand, last digits, and expiry, for display only |
| `billing_address` | PostalAddress | Optional. The card's billing address. When present, it's sent with the charge |
| `credential.type` | string | Must be `token` |
| `credential.token` | string | The token returned by `/tokenize` |
| `credential.expires_at` | string | The `expires_at` returned by `/tokenize` |

In UCP version `2026-08-25`, a Complete Checkout submission carries exactly one instrument.

### Successful payment

The following example shows the response when the payment succeeds:

```http
HTTP/1.1 200 OK

{
  "ucp": { "version": "2026-08-25", "status": "success" },
  "id": "b3c1e7a2-5f4d-4a8e-9c21-6d0f8e3a7b45",
  "status": "completed",
  "order": {
    "id": "9e4a2c71-3b8f-4d16-a5e0-2f7c9b1d8a63",
    "permalink_url": "https://merchant.example/orders/9e4a2c71-3b8f-4d16-a5e0-2f7c9b1d8a63"
  }
}
```

### Failure outcomes

The following table shows how to tell the failure outcomes apart and what to do next. The code and severity are those of the first entry in `messages`. Each outcome has an example response in the sections that follow.

| Outcome | `status` | Code | Severity | What to do |
|---|---|---|---|---|
| Token refused | `ready_for_complete` | `payment_declined` | `recoverable` | Tokenize the card again and retry Complete Checkout |
| Card declined by the issuer | `requires_escalation` | `payment_declined` | `requires_buyer_input` | Send the buyer to `continue_url` to pay with another card |
| Card payments unavailable for the business | `ready_for_complete` | `payment_failed` | `unrecoverable` | Offer another payment method, or send the buyer to the merchant's checkout page |
| Payment failed before the charge | `requires_escalation` | `payment_declined` | `recoverable` | Retry Complete Checkout later with the same token, or send the buyer to `continue_url` |

This section lists the payment outcomes specific to this handler. Invalid request shapes and duplicate or in-progress completions follow the UCP checkout capability.

#### Token refused

The token was refused because it's unknown, expired, or was issued for another checkout. Nothing was charged. The checkout keeps its payment handlers, so you can tokenize the card again and retry.

```http
HTTP/1.1 200 OK

{
  "ucp": { "version": "2026-08-25", "status": "success" },
  "id": "b3c1e7a2-5f4d-4a8e-9c21-6d0f8e3a7b45",
  "status": "ready_for_complete",
  "messages": [
    {
      "type": "error",
      "code": "payment_declined",
      "content": "Payment was declined",
      "severity": "recoverable"
    }
  ]
}
```

#### Card declined by the issuer

The issuer declined the card. Retrying with the same card declines again. The response returns no payment handlers and has the status `requires_escalation`. The buyer must pay with another card on the merchant's checkout page at `continue_url`.

```http
HTTP/1.1 200 OK

{
  "ucp": { "version": "2026-08-25", "status": "success" },
  "id": "b3c1e7a2-5f4d-4a8e-9c21-6d0f8e3a7b45",
  "status": "requires_escalation",
  "continue_url": "https://merchant.example/checkout?checkoutId=b3c1e7a2-5f4d-4a8e-9c21-6d0f8e3a7b45",
  "messages": [
    {
      "type": "error",
      "code": "payment_declined",
      "content": "Payment was declined",
      "severity": "requires_buyer_input"
    },
    {
      "type": "error",
      "code": "payment_requires_site_checkout",
      "content": "Payment must be completed on the merchant's checkout page.",
      "severity": "requires_buyer_input"
    }
  ]
}
```

#### Card payments unavailable for the business

The charge wasn't attempted because card payments aren't connected or are disabled for the business. Nothing was charged. The checkout keeps its payment handlers, but retrying the same request fails the same way. The buyer must pay another way or on the merchant's checkout page.

```http
HTTP/1.1 200 OK

{
  "ucp": { "version": "2026-08-25", "status": "success" },
  "id": "b3c1e7a2-5f4d-4a8e-9c21-6d0f8e3a7b45",
  "status": "ready_for_complete",
  "messages": [
    {
      "type": "error",
      "code": "payment_failed",
      "content": "The business cannot take this payment method right now, so nothing was charged. Pay another way or on the merchant's checkout page.",
      "severity": "unrecoverable"
    }
  ]
}
```

#### Payment failed before the charge

The payment failed before any charge was attempted, for example because a dependency was unavailable. Nothing was charged. The message has the same code and severity as a refused token, but the response returns no payment handlers and has the status `requires_escalation`. The token is still valid, so tokenizing the card again doesn't help. You can retry Complete Checkout later with the same token until it expires, or the buyer can pay on the merchant's checkout page at `continue_url`.

```http
HTTP/1.1 200 OK

{
  "ucp": { "version": "2026-08-25", "status": "success" },
  "id": "b3c1e7a2-5f4d-4a8e-9c21-6d0f8e3a7b45",
  "status": "requires_escalation",
  "continue_url": "https://merchant.example/checkout?checkoutId=b3c1e7a2-5f4d-4a8e-9c21-6d0f8e3a7b45",
  "messages": [
    {
      "type": "error",
      "code": "payment_declined",
      "content": "Payment was declined",
      "severity": "recoverable"
    },
    {
      "type": "error",
      "code": "payment_requires_site_checkout",
      "content": "Payment must be completed on the merchant's checkout page.",
      "severity": "requires_buyer_input"
    }
  ]
}
```

## Security

The following table describes how the handler protects card data:

| Requirement | Description |
|---|---|
| TLS | All tokenize calls must use HTTPS |
| PCI DSS | Your credential provider must be PCI compliant. Your main application and the agent must not have access to the raw card data |
| Binding | Every token is bound to the checkout and the business. The binding is checked when the token is used, and a token can't be used on another checkout |
| No detokenize | Tokens are resolved inside Wix only. No call returns card data |

## See also

- [Wix Payments handler schema](https://ucp.wixapps.net/payments/2026-04-08/schemas/schema.json)
- [UCP processor-tokenizer payment handler example](https://ucp.dev/2026-08-25/specification/payment/examples/processor-tokenizer-payment-handler/)