Settle x402 payment
Nanopayments Gateway
Settle Batched Payment
Settle an x402 payment with organization-specific authentication. This endpoint supports standard exact EIP-3009 EVM payloads, Circle Gateway batched payloads, and the Permit2 payload used on non-EIP-3009 EVM networks.
POST
Settle x402 payment
Settle a Nanopayments Gateway (Circle Gateway batched) payment. This is the same
POST /v1/settle endpoint used by the default x402 path. The facilitator inspects paymentRequirements.extra and forwards batched requests to Circle’s Gateway API instead of settling on-chain.
See Nanopayments Gateway Overview
for the end-to-end flow, supported networks, and Gateway Wallet contract
addresses.
Routing
A request is routed to Circle Gateway when all of the following are true:paymentRequirements.extra.name === "GatewayWalletBatched"paymentRequirements.extra.version === "1"- The network is Gateway-enabled (testnets always; mainnets gated by the facilitator’s
GATEWAY_MAINNET_ENABLEDflag, currentlytrue)
extra indicates batched but the network is not Gateway-enabled, the facilitator returns HTTP 403 with errorReason: "gateway_not_enabled".
Authentication
RequiresAuthorization: Bearer <api-key>. Recipient is taken from your organization settings or from paymentRequirements.extra.creditedRecipient.
Request Body
Field notes
| Field | Notes |
|---|---|
paymentRequirements.asset | Set to the Gateway Wallet contract for this network (used as verifyingContract in EIP-712 signing). The facilitator swaps it back to USDC before forwarding to Circle. |
paymentRequirements.maxTimeoutSeconds | 345600 (4 days) is the recommended Circle Gateway nanopayment validity window. |
payload.authorization.value | USDC base units (6 decimals). 10000 = 0.01 USDC. |
extra.name + extra.version | Required exactly as "GatewayWalletBatched" and "1". This is the routing trigger. |
Response
200: Success
The facilitator spreads Circle’s response and adds Meridian-specific fields. The exact shape is{ ...gatewayResponse, settlementMethod, network, testnet, authContext } after toJsonSafe():
successandtransaction(and any other fields) are forwarded from Circle.settlementMethod: "batched"confirms the Circle Gateway path was taken.testnetistruewhennetworkis one ofarc-testnet,base-sepolia,optimism-sepolia, orfluent-testnet.authContext.authMethodis the literal string"middleware_handled".- The settle path’s
authContextdoes not includeorganizationId(unlike verify).
400: Error from Circle Gateway
When Circle’s response hassuccess: false, the facilitator forwards it with HTTP 400. The shape is { ...gatewayResponse, settlementMethod, network, testnet } (no authContext):
403: Network not enabled
500: Facilitator-side failure forwarding to Circle
Error Codes
gateway_not_enabled:paymentRequirements.extramatched batched butisGatewayEnabledForNetwork(network)returnedfalse.batched_settle_error: forwarding to Circle threw before a response could be parsed (network error, SDK exception, etc.).- Any
errorReasonCircle returns: passed through verbatim alongsidesettlementMethod: "batched".
Authorizations
Body
application/json