x402 (AI agents)

Settle an x402 payment (facilitator)

Re-verifies, then P2Flux's relayer settles the payment through P2FluxX402Splitter and pays the gas. success: true carries the transaction hash. errorReason: \"settlement_pending\" carries a real hash of a transaction still being mined: repeat the identical call once (the x402 middleware does) and it is resolved, never broadcast twice. A payment is reported settled ONCE: any further settle call for it - concurrent, later, or after the payment was settled by someone else - is refused with errorReason: "invalid_transaction_state", so one payment can never buy two responses. Every settlement carries the P2Flux fee, max(1%, 0.003 USDC) and never more than half the payment, paid out of the amount in the same transaction. Refusals are 200 with success: false, an empty transaction and the network.

post/x402/settle

Request

  • Base URL: https://api.p2flux.com
  • URL: https://api.p2flux.com/x402/settle
  • Auth: none required

Request body

x402Version2 required
paymentPayloadobject required

What the agent sent: {x402Version, accepted, payload, extensions?}. payload is {signature, authorization} (exact, EIP-3009) or {signature, permit2Authorization} (upto).

Example request

{
  "paymentRequirements": {
    "network": "eip155:8453"
  }
}

Response

Settlement result

successboolean required
errorReasonstring
errorMessagestring
payerstring
transactionstring required

Transaction hash; empty when nothing was sent.

networkstring required
amountstring

Amount settled, token base units.

Example response

{
  "errorReason": "settlement_pending"
}

Changes

No recorded changes to this operation across all 1 revision of this API.