Settle a verified payment (gateway → facilitator)
const url = 'https://example.com/settle';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"x402Version":1,"paymentPayload":{"x402Version":1,"scheme":"example","network":"example","payload":{"signature":"example","authorization":{"from":"example","to":"example","value":"example","validAfter":"example","validBefore":"example","nonce":"example"}}},"paymentRequirements":{"scheme":"example","network":"example","maxAmountRequired":"example","asset":"example","payTo":"example","resource":"example","maxTimeoutSeconds":1}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/settle \ --header 'Content-Type: application/json' \ --data '{ "x402Version": 1, "paymentPayload": { "x402Version": 1, "scheme": "example", "network": "example", "payload": { "signature": "example", "authorization": { "from": "example", "to": "example", "value": "example", "validAfter": "example", "validBefore": "example", "nonce": "example" } } }, "paymentRequirements": { "scheme": "example", "network": "example", "maxAmountRequired": "example", "asset": "example", "payTo": "example", "resource": "example", "maxTimeoutSeconds": 1 } }'Once a facilitator is configured, the gateway hands the same Payment it verified — plus the PaymentRequirements it issued — to the facilitator as a SettleRequest, and the facilitator answers with a SettleResponse. A failed settle reports { "success": false, "errorReason": "…" } — one coarse reason, never internal detail. facilitatorFee is an optional extension; the self-hosted default takes no cut and omits it.
Request Bodyrequired
Section titled “Request Bodyrequired”POST /settle request body — verified payment handed to the facilitator.
object
The decoded X-PAYMENT header for the exact scheme.
object
The exact-scheme payload — signature over the authorization.
object
EIP-3009 transferWithAuthorization arguments the caller signed.
object
Payer address (hex)
Recipient address (hex)
Amount
Unix seconds
Unix seconds
Authorization nonce (hex)
One entry of a 402 challenge’s accepts array.
object
Decimal string (256-bit)
Token contract address (hex)
Examplegenerated
{ "x402Version": 1, "paymentPayload": { "x402Version": 1, "scheme": "example", "network": "example", "payload": { "signature": "example", "authorization": { "from": "example", "to": "example", "value": "example", "validAfter": "example", "validBefore": "example", "nonce": "example" } } }, "paymentRequirements": { "scheme": "example", "network": "example", "maxAmountRequired": "example", "asset": "example", "payTo": "example", "resource": "example", "maxTimeoutSeconds": 1 }}Responses
Section titled “Responses”The settlement result.
POST /settle response body. facilitatorFee is an optional extension a fee-recovering facilitator may report; absent on a self-hosted one.
object
Examplegenerated
{ "success": true, "errorReason": "example", "transaction": "example", "network": "example", "payer": "example", "facilitatorFee": "example"}