Docs

Agents

x402 over SEPA

x402 lets a server answer 402 Payment Required and a client pay by attaching a signed authorization that a facilitator verifies and settles. Whire plays the payer and the facilitator, with a bank mandate where a blockchain wallet would be.

The x402 v2 specification names sepa:eu as an example network but standardizes no fiat scheme, so Whire defines one: sepa-mandate. The standing authorization is the mandate (Mandates). The per-payment proof is produced by the payer and checked by the facilitator. It binds the exact authorization, { from, to, value, asset, validBefore, nonce }, to one payout and one mandate, so nothing can change between the payer producing it and the facilitator settling it. Sellers do not verify it themselves, which is why supported lists no signers; a seller's assurance is the settle response and the funds arriving, as with any open-banking payment initiation provider.

The facilitator sits on the payer's side: on SEPA only the mandate holder can move the money.

The handshake#

agent  → GET /report                        seller → 402 + PAYMENT-REQUIRED
agent    checks the mandate, creates the payout, signs
agent  → GET /report + PAYMENT-SIGNATURE    seller → POST /x402/verify, POST /x402/settle
                                            seller → 200 + resource + PAYMENT-RESPONSE

The three headers are base64 JSON. Below they are shown decoded. Every example on this page was produced against a running deployment with the simulated rail on.

Amounts in x402 messages are in atomic units of the asset, as x402 v2 requires: for EUR that is cents, as a positive integer string, so "100" is EUR 1.00. This applies to amount in a requirement and value in an authorization, and nowhere else: Whire's own API, the mandate limits, payouts and the mandateProposal and confirmation summaries are decimal. quote_x402_resource returns both, requirement.amount and amountDecimal.

The seller says 402#

GET /report — no payment attached#

Response 402, header PAYMENT-REQUIRED:

JSON
{
  "x402Version": 2,
  "resource": {
    "url": "https://vendor.example/report",
    "description": "Q3 market report",
    "mimeType": "application/json"
  },
  "accepts": [
    {
      "scheme": "sepa-mandate",
      "network": "sepa:eu",
      "amount": "100",
      "asset": "EUR",
      "payTo": "DE89370400440532013000",
      "maxTimeoutSeconds": 300,
      "extra": {
        "payeeName": "Report Vendor BV",
        "reference": "x402 Q3 market report"
      }
    }
  ]
}

The body carries the same object for humans. Nothing has moved. On the payer side, the MCP tool quote_x402_resource { url } reads this and commits nothing.

The facilitator#

The facilitator is served from the same base URL as the REST API, https://sandbox.whire.ai. /x402/supported needs no key. /x402/verify and /x402/settle take your API key, sent as X-API-Key like every other call; see Base URL and authentication.

A seller key is scoped to the IBAN or IBANs registered for you. It can verify and settle only payments whose payTo is one of those, and manage webhook endpoints for them, and it cannot call the rest of the API. Its webhook events carry the details of payments to its own IBANs, and nothing else. Sandbox and production keys are separate. Keys do not expire; to rotate, ask for a new key, switch when ready, and the old one is retired, both valid in between.

Three answers tell you which it was:

Status Body Meaning
401 Missing API key. Send it as the X-API-Key header. no key on the request
401 Invalid API key. revoked, mistyped, or the other environment's key
403 This key is registered for <IBAN> and cannot verify or settle payments addressed to <payTo>. the key is good, the payee is not yours

An outage never produces a 401 or 403.

GET/x402/supported

What this deployment can verify and settle. Empty on a deployment with no settlement rail, so that no seller serves a resource it can never be paid for.

signers is empty: the scheme publishes no public keys. Seller-verifiable proof would need per-payer keys listed here, which Whire does not offer today.

With the simulated rail:

JSON
{
  "kinds": [
    {
      "x402Version": 2,
      "scheme": "sepa-mandate",
      "network": "sepa:eu",
      "extra": {
        "settlement": "sepa-simulation",
        "simulated": true,
        "environment": "SANDBOX",
        "amountFormat": "atomic",
        "assetDecimals": 2
      }
    }
  ],
  "extensions": [],
  "signers": {}
}

Without a rail:

JSON
{ "kinds": [], "extensions": [], "signers": {} }

POST/x402/verify

The seller sends the decoded PAYMENT-SIGNATURE payload together with the requirement it published. Nothing moves. The checks, in order: tag intact; not expired; matches the requirement (payee, amount, asset); the payout exists, is approved and not already settled; the payout's beneficiary is the seller's IBAN; the mandate still validates for it.

Request

JSON
{
  "x402Version": 2,
  "paymentPayload": {
    "x402Version": 2,
    "resource": {
      "url": "https://vendor.example/report",
      "description": "Q3 market report"
    },
    "accepted": {
      "scheme": "sepa-mandate",
      "network": "sepa:eu",
      "amount": "100",
      "asset": "EUR",
      "payTo": "DE89370400440532013000",
      "maxTimeoutSeconds": 300,
      "extra": {
        "payeeName": "Report Vendor BV",
        "reference": "x402 Q3 market report"
      }
    },
    "payload": {
      "payoutId": "b1f75ef4-c754-4a58-8d18-bdbf0042e453",
      "mandateReference": "X402-001",
      "authorization": {
        "from": "NL91ABNA0417164300",
        "to": "DE89370400440532013000",
        "value": "100",
        "asset": "EUR",
        "validBefore": "1790191414",
        "nonce": "4f2c9a1e7b3d"
      },
      "signature": "sepa-mandate-sig-075e231d6fb6abd4736f9658e33c47741607c6b0e9722a2779607bf7f6d85069"
    }
  },
  "paymentRequirements": {
    "scheme": "sepa-mandate",
    "network": "sepa:eu",
    "amount": "100",
    "asset": "EUR",
    "payTo": "DE89370400440532013000",
    "maxTimeoutSeconds": 300,
    "extra": {
      "payeeName": "Report Vendor BV",
      "reference": "x402 Q3 market report"
    }
  }
}

Response 200

JSON
{
  "isValid": true,
  "payer": "NL91ABNA0417164300"
}

With the value edited to 500 after signing:

JSON
{
  "isValid": false,
  "invalidReason": "Authorization signature does not verify.",
  "payer": "NL91ABNA0417164300"
}

A body that is not JSON answers 400 with an error. Every other outcome is a 200 with isValid set, so read the field rather than the status.

POST/x402/settle

Same request body as verify. Verifies again, then executes the payout through the rail.

Response 200

JSON
{
  "success": true,
  "transaction": "SIM-37F5A5A9",
  "network": "sepa:eu",
  "payer": "NL91ABNA0417164300",
  "settlement": "sepa-simulation",
  "simulated": true
}

Settle is idempotent for the same signed payload — asking again returns the same transaction, so a seller that got no answer can retry and serve.

While the rail has accepted a payment but not yet settled it, settle answers the code x402 clients key on:

JSON
{
  "success": false,
  "errorReason": "settlement_pending",
  "detail": "sepa-simulation accepted payment SIM-2B7C11E0 and has not settled it yet. Settle again with the same payload once it has; that call is idempotent.",
  "transaction": "SIM-2B7C11E0",
  "network": "sepa:eu",
  "payer": "NL91ABNA0417164300"
}

errorReason is exactly settlement_pending; detail is for humans; transaction is the rail's reference, the same one the eventual success carries. Do not serve, and do not ask the agent to pay again: re-submit the identical body until success is true. A seller that starts over from verify gets the same code there, as invalidReason, and should go on to settle. Any other errorReason is a failure. On a deployment with no rail, settle answers success: false and says it does not settle.

You do not have to keep asking. A webhook tells you when a pending settlement completes (payout.paid, whose transaction is the rail's reference; match on the payout id, because settle's transaction is an empty string until the rail confirms) and when a settled payment is later returned by the bank (payout.returned), which settle cannot tell you because it has already answered.

From Python, a seller calls the facilitator with client.x402: supported(), verify(payment_payload=..., payment_requirements=...) and settle(...). They never raise on is_valid: false or success: false; read the fields, and when error_reason is settlement_pending, settle again later.

The seller serves#

GET /report — with PAYMENT-SIGNATURE#

The seller called verify, then settle, then served.

Response 200, header PAYMENT-RESPONSE:

JSON
{
  "success": true,
  "transaction": "SIM-37F5A5A9",
  "network": "sepa:eu",
  "payer": "NL91ABNA0417164300",
  "settlement": "sepa-simulation",
  "simulated": true
}

Body: whatever the resource is. A seller may want to echo the settlement, for example paidBy and the transaction, so the agent's operator can reconcile later.

Settle before serving. The x402 spec orders verify → serve → settle, which works when a chain has already locked the funds; a bank transfer is not pre-funded, so serving first would extend credit. On a deployment with no rail, verify is all there is, and a seller that serves on a valid verification is choosing to trust the authorization alone.

The payer side#

Two MCP tools, offered only on deployments that can settle (MCP server):

  • quote_x402_resource { url } — read the 402; commits nothing.
  • pay_x402_resource { url, mandateId? } — checks the mandate for the quoted amount and payee, creates the payout, waits for the KYC decision, signs, retries the request. Refused by the mandate → nothing is created.

mandateId is optional. Without it, the payer uses the mandate that covers this seller. When no mandate names the seller yet, the first payment is where the person approves one, in the session: nothing is created, and the result carries reason: "mandate_required" and a mandateProposal read from the 402:

JSON
{
  "paid": false,
  "status": 402,
  "reason": "mandate_required",
  "mandateProposal": {
    "beneficiaryId": "0f3c1b7e-...",
    "payeeName": "Report Vendor BV",
    "payTo": "DE89370400440532013000",
    "amount": "1.00",
    "asset": "EUR",
    "suggested": { "mandateReference": "X402-VENDOR.EXAMPLE-K3M9Q1", "currency": "EUR", "maxAmount": 1, "maxTotalAmount": 10 },
    "youProvide": ["payerId (a verified payer) or debtorName + debtorIban", "signedBy"]
  }
}

The amounts here are decimal, because a person reads them and the mandate limits are decimal; only the x402 messages themselves carry cents. The agent shows this to its principal. One approval creates the mandate, with the suggested limits or the person's own, and the agent pays again. From then on every payment to that seller under the mandate is automatic, until its caps or validity run out.

Paying sellers nobody approved: the budget mandate#

A named mandate makes the first payment to each seller a human decision. A budget mandate removes it: payeeScope: "any_verified", no beneficiary, a cap per payment, a total, a validity window. A person signs it once. The agent then pays any seller whose 402 fits the caps, and the payee check on each payout decides whether the seller may be paid. By default the person meets each new seller once, through the agent, and every later payment to it within the caps is unattended; with the policy off there is no human per payment and no step per seller at all. Either way the person's one standing decision is the budget, as funding a wallet is on chain.

The payer prefers a mandate that names the seller over a budget that merely covers it, so a specific decision about a payee always wins over a general one.

Who gets asked, and when, is the person's choice, written into the mandate and enforced by the pay tool:

Field Effect
confirmNewPayee ask before the first payment to a payee this mandate has not paid yet; on by default for a budget. The third payment to that seller is not asked
confirmAbove ask before a payment above this amount; off by default
confirmNewPayee: false and no confirmAbove never ask, for micropayments

When a policy fires, nothing is created and the result carries reason: "confirmation_required" with a confirmation summary: mandate, payee name and IBAN, amount, and because listing which policy fired. The agent shows it; on a yes it calls again with confirmed: true. In the Python toolkit this is the confirm callback.

The authorization model is unchanged: a person signs, the agent spends within what was signed. The budget mandate only changes what the person signs, from a payee to a limit.

Where the human step is#

The REST payouts flow has an optional confirm call that records a person's go-ahead between approval and execution. The x402 payer does not call it, and this is deliberate. In x402 the seller serves as soon as settle succeeds, so the only moment a person can usefully decide is before the agent signs. That moment is the mandate: a person signs it, and its confirmation policy says whether the agent must also ask before a new payee or above an amount. When the policy fires, pay_x402_resource stops before creating anything and returns confirmation_required; the person's yes is the confirmation, and it happens before the payout exists rather than after it. There is no second human step between the payee check and the signature, and the tool is marked as destructive so an MCP host asks before calling it at all.

The signed authorization is the commitment; everything before it is reversible.

From Python, the same two steps are client.x402.quote and client.x402.pay:

Python
quote = await client.x402.quote(url="https://vendor.example/report")
if not quote.free:
    paid = await client.x402.pay(url=quote.url, mandate_id=mandate.mandate_id, reason="Q3 report")
    print(paid.paid, paid.status, paid.payout_id)

Try it#

Ask the sandbox what it can settle. No key needed:

Then point an agent with a mandate at any URL that answers 402 with a sepa-mandate requirement, or write a seller that calls verify and settle with your key. Every outcome a bank can produce is available on demand; see Simulation.