# MONEI UCP payment handler

`com.monei.payments` version `2026-12-01` supports card and Bizum payments on Universal Commerce Protocol (UCP) core version `2026-08-25`.

MONEI hosts card tokenization and processes the payment. The agent platform submits a one-time token to the merchant in Complete Checkout. For Bizum, the agent platform submits the buyer's phone number. The buyer approves the payment in their bank app or continues on a MONEI payment page.

## Participants[​](#participants "Direct link to Participants")

| Participant    | Role                                                                                |
| -------------- | ----------------------------------------------------------------------------------- |
| Merchant       | Advertises the handler, owns the checkout and creates the MONEI payment.            |
| Agent platform | Collects payment details, requests a token for cards and submits Complete Checkout. |
| MONEI          | Issues card tokens, processes payments and hosts 3DS Action surfaces.               |

<!-- -->

## Merchant integration[​](#merchant-integration "Direct link to Merchant integration")

### Prerequisites[​](#merchant-prerequisites "Direct link to Prerequisites")

Use a MONEI account that can process payments in the environment you advertise. Enable the methods you plan to offer and keep the merchant API key on your server. Implement UCP Checkout with a stable checkout ID.

### Handler configuration[​](#configuration "Direct link to Handler configuration")

Declare the handler in `ucp.payment_handlers` at `/.well-known/ucp`. The [handler schema](https://monei.com/ucp/payments/2026-12-01/schema.json) defines the discovery and response shapes.

| Context                                  | Required `config` fields                                                                                |
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| Merchant discovery and checkout response | `environment` is `live` or `test`. `account_id` is the merchant's MONEI account ID in that environment. |
| Agent platform discovery                 | `environment` is `live` or `test`.                                                                      |

Use the same handler `id` in discovery and Checkout. In each Checkout response, include the handler's `id`, `version`, `available_instruments` and runtime `config` under `ucp.payment_handlers`. Advertise only instruments and card brands you can process for that checkout.

| Instrument | Constraints                                                                                                                                                                                                         | Credential at Complete Checkout                  |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
| `card`     | `brand` can be `visa` or `mastercard`.                                                                                                                                                                              | `monei_payment_token` with `token` and `expiry`. |
| `bizum`    | EUR only. Your MONEI account must have Bizum enabled. The buyer needs a bank account in Spain or Andorra enrolled in Bizum. See [Bizum availability](https://docs.monei.com/payment-methods/bizum.md#availability). | `bizum_phone` with E.164 `phone_number`.         |

This example merchant profile advertises both instruments.

```
{

  "ucp": {

    "version": "2026-08-25",

    "payment_handlers": {

      "com.monei.payments": [

        {

          "id": "monei",

          "version": "2026-12-01",

          "spec": "https://docs.monei.com/ucp/payments-handler",

          "schema": "https://monei.com/ucp/payments/2026-12-01/schema.json",

          "available_instruments": [

            {

              "type": "card",

              "constraints": {"properties": {"brand": {"enum": ["visa", "mastercard"]}}}

            },

            {"type": "bizum"}

          ],

          "config": {"environment": "live", "account_id": "<merchant account ID>"}

        }

      ]

    }

  }

}
```

### Process Complete Checkout[​](#process-payments "Direct link to Process Complete Checkout")

1. Lock the checkout so only one Complete Checkout request runs at a time, for both card and Bizum. Validate the selected instrument's `handler_id` against the handler you advertised. Use one stable `orderId` per checkout. A stable `orderId` alone cannot prevent concurrent charges.
2. While holding the lock, match the Complete Checkout request to its `Idempotency-Key`. For an identical replay, return the original result without creating a payment. A fresh key starts a new attempt once the checkout is `ready_for_complete`. Before replacing an attempt, read its payment and confirm it ended in `EXPIRED`, `CANCELED` or `FAILED`. Use your API key to create the payment with `POST /v1/payments`. Use the same `orderId` for every attempt. Take `amount` and `currency` from your checkout total and include a `callbackUrl`.
3. For cards, send `credential.token` as `paymentToken` and the [derived checkout binding](#session-id) as `sessionId`. Omit `generatePaymentToken` and `sequence` on all requests that use this token.
4. For Bizum, send the E.164 `credential.phone_number` as `paymentMethod.bizum.phoneNumber` and omit `paymentToken` and `sessionId`. If you receive a known Spanish number with nine digits, you can add `+34` before sending it. Follow the [Bizum flow](#bizum).
5. Store the new payment ID as the current attempt and keep the result for each key. Do this before releasing the lock. Map the recorded MONEI result to Checkout using the [result table](#payment-results).

While the checkout is `complete_in_progress`, read `GET /v1/payments/{id}` on each Get Checkout poll or on a timer. Keep polling while the result is pending. `EXPIRED` does not trigger `callbackUrl`. An account webhook subscribed to `charge.expired` can report it.

[Verify the signature](https://docs.monei.com/guides/verify-signature.md) before using a callback or webhook payload. If a callback is unsigned, read the current payment with your API key before updating Checkout. Apply updates only for the current payment. Ignore stale results, including `PENDING` after `completed`.

This example card payment charges 45.90 EUR against the 49.90 EUR token ceiling in the [tokenize request](#tokenize).

```
{

  "amount": 4590,

  "currency": "EUR",

  "orderId": "order_abc123",

  "paymentToken": "0123456789abcdef0123456789abcdef01234567",

  "sessionId": "ucp_p9B1ORosznAReuyLG2v-dp46pBXBFwgUKvrA",

  "callbackUrl": "https://merchant.example/payment-updates"

}
```

This example sends a Bizum payment request to `POST /v1/payments`.

```
{

  "amount": 1200,

  "currency": "EUR",

  "orderId": "order_bizum123",

  "paymentMethod": {"bizum": {"phoneNumber": "+34500000000"}},

  "callbackUrl": "https://merchant.example/payment-updates"

}
```

See the [REST API reference](https://docs.monei.com/apis/rest.md).

### Derive the card payment session ID[​](#session-id "Direct link to Derive the card payment session ID")

Use the same binding as tokenization. Set `binding.type` to `dev.ucp.shopping.checkout` and `binding.id` to the checkout ID. Join the exact type and ID with one literal `|`, encode the result as UTF-8, and compute the SHA-256 digest. Base64url-encode the **raw digest** without padding, take the first 36 characters and prepend `ucp_`. Preserve the ID exactly, including case, spaces and Unicode. Use the decoded ID value without JSON escaping, URL encoding or Unicode normalization.

```
sessionId = "ucp_" + base64url_nopad(sha256(utf8(binding.type + "|" + binding.id)))[0:36]
```

| `binding.type`              | `binding.id` | Expected `sessionId`                       |
| --------------------------- | ------------ | ------------------------------------------ |
| `dev.ucp.shopping.checkout` | `chk_abc123` | `ucp_p9B1ORosznAReuyLG2v-dp46pBXBFwgUKvrA` |
| `dev.ucp.shopping.checkout` | `chk/é "1`   | `ucp_d8Qg7xkO9tLDqlKDuG_V-fx8VhC-HXPbAzQs` |

### Map payment results to Checkout[​](#payment-results "Direct link to Map payment results to Checkout")

Apply the Bizum-specific rows before the general rows. Ignore any stale result that would move the checkout backward.

| MONEI result                                                                                                                                         | UCP response or merchant action                                                                                                                                                              |
| ---------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `SUCCEEDED`                                                                                                                                          | Return `completed`.                                                                                                                                                                          |
| Order already paid or authorized                                                                                                                     | Read the existing payment, then return `completed`.                                                                                                                                          |
| Order pending processing                                                                                                                             | Return `complete_in_progress` and read the existing payment.                                                                                                                                 |
| Card `FAILED`, issuer decline                                                                                                                        | Return recoverable `payment_declined`.                                                                                                                                                       |
| Card `FAILED` with `E301` (3DS authentication failed)                                                                                                | Return recoverable `payment_failed`. The buyer can retry with a fresh token for the same card or another card.                                                                               |
| Card `PENDING` with `FRICTIONLESS_CHALLENGE`                                                                                                         | If the extension was negotiated, return `complete_in_progress` with a device data collection Action. Otherwise use escalation.                                                               |
| Card `PENDING` with `CHALLENGE`                                                                                                                      | If the extension was negotiated, return `complete_in_progress` with a 3DS challenge Action under a new ID. Otherwise use escalation.                                                         |
| Card `PENDING` with `INSTALLMENT_SELECT` (MONEI Flex, amounts of €60 or more) or `CONFIRM` (buyer input required)                                    | Return `requires_escalation` with `continue_url` set to `nextAction.redirectUrl`.                                                                                                            |
| `PENDING` with `COMPLETE`                                                                                                                            | Return `complete_in_progress` and keep polling. The URL is a receipt or the merchant's return page and must never be used for escalation.                                                    |
| `EXPIRED` or `CANCELED`                                                                                                                              | Return recoverable `payment_failed` and move the checkout to `ready_for_complete`. Detect `EXPIRED` by reading the payment.                                                                  |
| `E206` (binding, amount ceiling, currency or token source)                                                                                           | Return recoverable `payment_failed`. The agent platform tokenizes again for the correct checkout and amount.                                                                                 |
| `E229` (token used or expired)                                                                                                                       | First read the payment for this checkout. If a payment is open or succeeded, use its recorded state. Otherwise return recoverable `payment_failed` so the agent platform can tokenize again. |
| `E232`, agent token submitted with `generatePaymentToken` or `sequence`                                                                              | Fix the merchant integration to omit the fields.                                                                                                                                             |
| Bizum `PENDING` with a `nextAction.redirectUrl` path of `/payments/{id}/confirm` and a `paymentToken` query parameter                                | Return `requires_escalation`. Set `continue_url` to the full `nextAction.redirectUrl`.                                                                                                       |
| Bizum `PENDING` with a `nextAction.redirectUrl` path of `/payments/{id}/challenge`                                                                   | Return `complete_in_progress` with a message that asks the buyer to approve the payment in their bank app. Poll the payment.                                                                 |
| Bizum `FAILED` with `statusCode` `E649` (payer not found) or `E652` (buyer disabled Bizum)                                                           | Return recoverable `payment_failed` and move the checkout to `ready_for_complete`.                                                                                                           |
| Bizum `POST /v1/payments` returns HTTP `400` because the phone number is unregistered                                                                | Return recoverable `payment_failed` and move the checkout to `ready_for_complete`.                                                                                                           |
| Other Bizum `FAILED` payments, for example `E642` (insufficient funds), `E643` (payer rejected the charge) or `E646` (processor rejected the charge) | Return recoverable `payment_failed` and move the checkout to `ready_for_complete`.                                                                                                           |

## Agent platform integration[​](#agent-platform-integration "Direct link to Agent platform integration")

### Onboarding[​](#onboarding "Direct link to Onboarding")

For card tokenization, the agent platform must pass MONEI's business verification (KYB), submit a PCI DSS Attestation of Compliance (AoC), and sign the onboarding terms. After approval, create a [scoped API key](https://docs.monei.com/guides/scoped-api-keys.md#scopes) with `ucpTokens:create` on the approved account. Use `mk_live_` for live merchant accounts and `mk_test_` for test merchant accounts. Keep the key and card collection in your PCI-compliant environment. The agent platform and merchant can integrate directly under this handler without a separate agreement with each other.

Bizum requires no MONEI key or PCI DSS AoC from the agent platform. The merchant authenticates the payment request to MONEI.

### Discover the handler[​](#discover "Direct link to Discover the handler")

Advertise `com.monei.payments` in your agent platform's `ucp.payment_handlers` registry with the handler version, specification and schema URLs shown in the merchant profile above, your supported instruments and `config.environment`. Discover the merchant's handler at `/.well-known/ucp` and read the Checkout response for that checkout's eligible instruments and `config`.

### Tokenize a card[​](#tokenize "Direct link to Tokenize a card")

Send `POST https://api.monei.com/v1/ucp/tokenize` from your server with `Authorization: mk_live_…` (or `mk_test_…`), `Content-Type: application/json` and a `User-Agent` that identifies your integration. Include your agent profile in `UCP-Agent`, for example `profile="https://agent.example/.well-known/ucp"`.

```
{

  "credential": {

    "type": "pan",

    "number": "4111111111111111",

    "expiry_month": 9,

    "expiry_year": 2030,

    "cvc": "123",

    "name": "Jane Doe"

  },

  "binding": {"type": "dev.ucp.shopping.checkout", "id": "chk_abc123"},

  "identity": {"access_token": "<merchant account ID>"},

  "usage_limits": {"max_amount": 4990, "currency": "EUR"},

  "signals": {"dev.ucp.buyer_ip": "203.0.113.42", "dev.ucp.user_agent": "Mozilla/5.0 ..."}

}
```

| Field                   | Requirements                                                                                                                                                                             |
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `credential`            | Required. Only `pan` is supported. The number must have 13–19 digits and pass Luhn validation. The CVC has 3–5 digits. Send the expiry month (1–12) and year (2000–2099) as integers.    |
| `binding`               | Required. For Checkout, use `dev.ucp.shopping.checkout` and the checkout ID. The endpoint accepts any reverse-DNS type and IDs of 1–255 characters. Unknown binding members are ignored. |
| `identity.access_token` | Required. Copy `config.account_id` from Checkout. This public identifier selects the merchant. The scoped API key authenticates the caller.                                              |
| `usage_limits`          | Required MONEI handler field. `max_amount` is the authorized ceiling in minor currency units. The final amount may be lower. `currency` must match the charge exactly.                   |
| `signals`               | Send `dev.ucp.buyer_ip` and `dev.ucp.user_agent` with every card. 3D Secure needs them: when the issuer asks for authentication, a charge without them fails with `E304`.                |

HTTP `200` returns a single-use `token` as a 40-character hexadecimal string. The token is valid for 15 minutes. The `expiry` field gives the expiration time in ISO 8601 UTC. Tokenize again before `expiry`.

```
{

  "token": "0123456789abcdef0123456789abcdef01234567",

  "expiry": "2026-12-01T12:15:00.000Z"

}
```

| Status | Meaning                                                                                                                                    |
| ------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `400`  | Invalid request or card. An unknown merchant, a merchant unable to process or an environment mismatch all receive the same error response. |
| `401`  | Missing, malformed, unknown or revoked API key, or the caller cannot access the API.                                                       |
| `403`  | Missing `ucpTokens:create`, the caller is using an unscoped key or the account lacks agent platform approval or cannot process payments.   |

### Submit the payment instrument[​](#complete-checkout "Direct link to Submit the payment instrument")

In `POST /checkout-sessions/{checkout_id}/complete`, set `handler_id` to the Checkout handler's `id` and mark the instrument as selected. For a card, copy `token` and `expiry` from the tokenize response into the `monei_payment_token` credential.

```
{

  "payment": {

    "instruments": [

      {

        "id": "instrument_1",

        "handler_id": "monei",

        "type": "card",

        "selected": true,

        "credential": {

          "type": "monei_payment_token",

          "token": "0123456789abcdef0123456789abcdef01234567",

          "expiry": "2026-12-01T12:15:00.000Z"

        }

      }

    ]

  }

}
```

This example sends the buyer's phone number for Bizum in Complete Checkout.

```
{

  "payment": {

    "instruments": [

      {

        "id": "instrument_1",

        "handler_id": "monei",

        "type": "bizum",

        "selected": true,

        "credential": {

          "type": "bizum_phone",

          "phone_number": "+34500000000"

        }

      }

    ]

  }

}
```

Use Get Checkout with bounded backoff to observe `complete_in_progress`. Stop polling at `expires_at`. Only retry a lost Complete Checkout response with the identical request and idempotency key if Get Checkout cannot establish whether the original request was processed. A new attempt after `ready_for_complete` uses a fresh idempotency key and, for cards, a fresh token.

## Card 3DS Actions[​](#3ds-actions "Direct link to Card 3DS Actions")

When the checkout negotiates [UCP Payment Authentication](https://ucp.dev/2026-08-25/specification/payment/extensions/authentication/) (`dev.ucp.common.payment.authentication`), the merchant returns `complete_in_progress` and at most one outstanding Action. Set `config.payment_instrument_id` to the card instrument ID. Use the Action type as the key in the checkout's `actions` map.

| MONEI `nextAction.type`  | UCP Action type                                 | `mode`                                |
| ------------------------ | ----------------------------------------------- | ------------------------------------- |
| `FRICTIONLESS_CHALLENGE` | `dev.ucp.common.payment.device_data_collection` | `ddc` (hidden EMV 3DS Method)         |
| `CHALLENGE`              | `dev.ucp.common.payment.three_ds_challenge`     | `challenge` (visible buyer challenge) |

If collection leads to a challenge, emit the challenge with a new Action ID in a later Checkout response.

Set the Action's `config.url` using this template. URL-encode each variable component.

```
https://secure.monei.com/ucp/three-ds/{paymentId}?mode={mode}&id={actionId}&v={extensionVersion}&host={agentPlatformOrigin}
```

* `id` is the Action occurrence ID and `v` is the negotiated extension version.
* For web, the merchant passes the agent platform's HTTPS web origin in `host`, including a port if needed, without a path. MONEI uses that declared origin for frame embedding and web messages. Omit `host` for native webviews using the UCP native bridge. Without it, web framing is disabled.
* The browser checks `host` against every ancestor frame. Load the surface directly from a page on that origin. An intermediate iframe on another origin, such as a sandbox subdomain, blocks the surface.
* The agent platform MUST accept only `https://secure.monei.com` as the Action surface origin and register its message receiver before loading the URL. For every web message, verify that `event.source` is the mounted Action surface window and `event.origin` is the allowed origin.

The surface sends the JSON-RPC `action.ready` request with the Action ID and extension version. Ignore requests from an untrusted source or origin. If both values match, reply with the same JSON-RPC request ID and `result: {}`. The surface begins work only after that acknowledgement. If either value differs on a trusted request, reply with the same request ID and put a UCP error response in `result`. Set `ucp.status` to `error` and include `ucp.version` and a `messages` entry that describes the mismatch. Then follow the recovery steps below.

After a successful handshake, the surface sends at most one terminal notification. Both methods carry the Action ID in `params.id` and omit payment data and tokens. For `action.error`, look for the recoverable error code in `params.error.messages`.

| Notification                             | Meaning                                                                                                                                                                                                    |
| ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `action.done`                            | The recorded payment state shows that the step ended. For a challenge this includes success, authentication failure or buyer cancellation. For collection it also includes progression to a new challenge. |
| `action.error` with `action_unavailable` | The payment is already outside the expected authentication step before the surface starts it.                                                                                                              |
| `action.error` with `action_failed`      | Three consecutive payment status reads failed.                                                                                                                                                             |
| `action.error` with `action_expired`     | The 15-minute challenge window after payment confirmation passed without a recorded outcome.                                                                                                               |

After `action.done`, unmount the surface and call Get Checkout. If the same Action is still outstanding, poll with bounded backoff for up to 30 seconds. Stop earlier at `expires_at`. The merchant determines the checkout outcome from the recorded payment status. If the same Action remains after polling, use the Checkout Actions fallback.

After a handshake mismatch, `action.error`, a load failure, a timeout or buyer dismissal, unmount the surface and call Get Checkout once. Follow a response that removes the Action, replaces it with a new ID or advances the checkout. If the same Action is still outstanding, follow the [Checkout Actions fallback rules](https://ucp.dev/2026-08-25/specification/shopping/checkout/#actions). Never reopen the same Action ID.

Without the extension, return `requires_escalation` and set `continue_url` to `nextAction.redirectUrl` for the card authentication step.

## Bizum[​](#bizum "Direct link to Bizum")

The agent platform sends the buyer’s number in E.164, for example `+34600000000`. Use the selected instrument’s `credential.phone_number` with credential type `bizum_phone` and instrument type `bizum`. The merchant must limit Complete Checkout requests per phone number to prevent repeated approval prompts.

For a Bizum payment in `PENDING`, check the path in `nextAction.redirectUrl`. Both flows can return `CHALLENGE` in `nextAction.type`.

* If the path is `/payments/{id}/confirm` and the URL has a `paymentToken` query parameter, the buyer must open the MONEI payment page. Return `requires_escalation` and set `continue_url` to the full `nextAction.redirectUrl`.
* If the path is `/payments/{id}/challenge`, the buyer approves the payment in their bank app. Return `complete_in_progress` with a UCP informational message, for example `{"type":"info","content":"Confirm the payment in your bank app."}`. Set the checkout's `expires_at` to at least six minutes after Complete Checkout. The agent platform polls Get Checkout while the merchant reads the payment until it reaches a final status.

To test Bizum, set the handler's `environment` to `test` and use your test account and API key. Use the [Bizum test phone number and amounts](https://docs.monei.com/testing.md#test-bizum-phone-numbers).

## Security considerations[​](#security "Direct link to Security considerations")

| Requirement                       | Rule                                                                                                                                                                                                           |
| --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Transport and card data           | Use HTTPS. Keep the PAN and CVC within the PCI-compliant card collection and tokenization flow. Never send them to the merchant or write them to logs.                                                         |
| API key isolation                 | Keep keys server-side and out of published config. The agent platform's scoped key authenticates tokenization. The merchant's key authenticates payment creation.                                              |
| Binding creation and verification | MONEI binds the token to one merchant and the exact checkout binding. The merchant supplies the derived `sessionId` at charge time, and MONEI verifies the merchant account and `sessionId` before processing. |
| Reserved prefix                   | `ucp_` is reserved, case-insensitively. Public `POST /v1/tokens` rejects it, and payments using that prefix accept only UCP tokens.                                                                            |
| Amount and currency               | Use the merchant's checkout total. MONEI enforces the ceiling and exact currency match.                                                                                                                        |
| Token lifetime and use            | A token can be claimed once within 15 minutes. It cannot be stored as a card on file or used for recurring payments or card validation.                                                                        |
| Action URLs                       | Trust only `https://secure.monei.com` for embedded Actions. Treat authentication URLs as sensitive links and keep them out of public logs. The declared `host` controls web framing and messaging.             |
| Bizum phone data                  | Collect the buyer's phone for the payment, protect it as personal data and limit Complete Checkout requests per phone.                                                                                         |

## References[​](#references "Direct link to References")

* Handler specification — `https://docs.monei.com/ucp/payments-handler`
* [Handler schema for `2026-12-01`](https://monei.com/ucp/payments/2026-12-01/schema.json)
* [UCP Checkout](https://ucp.dev/2026-08-25/specification/shopping/checkout/)
* [UCP Payment Tokenization](https://ucp.dev/2026-08-25/specification/payment/tokenization/)
