Skip to main content
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_ENABLED flag, currently true)
If extra indicates batched but the network is not Gateway-enabled, the facilitator returns HTTP 403 with errorReason: "gateway_not_enabled".

Authentication

Requires Authorization: Bearer <api-key>. Recipient is taken from your organization settings or from paymentRequirements.extra.creditedRecipient.

Request Body

Field notes

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():
  • success and transaction (and any other fields) are forwarded from Circle.
  • settlementMethod: "batched" confirms the Circle Gateway path was taken.
  • testnet is true when network is one of arc-testnet, base-sepolia, optimism-sepolia, or fluent-testnet.
  • authContext.authMethod is the literal string "middleware_handled".
  • The settle path’s authContext does not include organizationId (unlike verify).

400: Error from Circle Gateway

When Circle’s response has success: 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.extra matched batched but isGatewayEnabledForNetwork(network) returned false.
  • batched_settle_error: forwarding to Circle threw before a response could be parsed (network error, SDK exception, etc.).
  • Any errorReason Circle returns: passed through verbatim alongside settlementMethod: "batched".

Authorizations

Authorization
string
header
required

Body

application/json
paymentPayload
object
required

Payload accepted by POST /v1/settle. Permit2 is currently settle-only; the deprecated POST /v1/verify endpoint still uses the legacy PaymentPayload schema.

paymentRequirements
object
required

Response

Payment settlement result

success
boolean
required
transaction
string
required

Transaction hash on success. Empty string on failure.

network
string
required
payer
string
errorReason
string
authContext
object