@circle-fin/x402-batching/server SDK and exposes it through the standard /v1/verify and /v1/settle endpoints.
Nanopayments Gateway UI
Deposit and withdraw USDC against the Gateway Wallet contract from a hosted UI.
Endpoints
Settle Batched Payment
POST /v1/settle settles a batched payment via Circle Gateway.Verify Batched Payment
POST /v1/verify verifies a batched payment without settling.Gateway Status
GET /v1/batched-sample reports Gateway connectivity for diagnostics.Detection
A payment is routed through the Nanopayments Gateway when both of these are present inpaymentRequirements.extra:
isBatchPayment() from @circle-fin/x402-batching/server inside the facilitator’s /v1/verify and /v1/settle handlers. There are no separate URLs for batched flows. Clients call the same endpoints used for default x402 settlement, and the facilitator inspects extra to decide where to forward the request.
Supported networks
isGatewayEnabledForNetwork() returns true for every network listed below. Testnets are always enabled, and mainnets are gated by the GATEWAY_MAINNET_ENABLED flag in the facilitator (currently true). The Meridian facilitator will accept requests for these networks and forward them to Circle.
Testnets
Mainnets
The Gateway Wallet addresses are deployed by Circle at the same address on every supported EVM chain (verified against Circle’s contract addresses page).
The facilitator forwards batched requests to:
- Testnet:
https://gateway-api-testnet.circle.com(explicit URL passed toBatchFacilitatorClient). - Mainnet: the default URL baked into
@circle-fin/x402-batching/server. The facilitator constructsnew BatchFacilitatorClient()with nourloverride.
Funding the Gateway Wallet
Buyers fund the Gateway Wallet contract on each source chain they want to spend from. Available balance is unified across deposits, so a single signed payment can be settled from any chain that has been funded.Deposit flow
-
USDC.approve(gatewayWallet, value). One-time per source chain. -
GatewayWallet.deposit(usdcAddress, value). Pulls USDC and credits the depositor’s balance. Circle also exposesdepositFor,depositWithPermit, anddepositWithAuthorizationon the wallet contract. -
After the deposit transaction is finalized onchain, the credit becomes part of
availableBalanceand can be spent. Time-to-finality is chain-specific:Source: Circle’s Required block confirmations table.
Withdrawal flow
Circle’s Gateway Wallet supports two withdrawal paths:- Instant (preferred): submit a same-chain transfer through the Gateway API. Funds round-trip through a burn on the source chain and a mint on the destination (same chain), so the withdrawal still requires a user-signed authorization. Pays only burn-tx gas.
- Trustless (fallback for when Circle’s API is unavailable): on-chain only, with a 7-day delay enforced by the
withdrawalBlockvalue on the Gateway Wallet contract.
GatewayWallet.initiateWithdrawal(usdc, value). Moves balance fromavailableBalancetowithdrawingBalanceand recordswithdrawalBlock.- After
block.number >= withdrawalBlock, callGatewayWallet.withdraw(usdc). Moves the unlocked amount fromwithdrawableBalanceback to the buyer’s wallet.
Balance views
The Gateway Wallet exposes per-token, per-depositor views the SDK reads:
The hosted Nanopayments Gateway UI wraps these calls so end users do not have to call the contract directly.
extra field reference
In the Nanopayments Gateway path, only extra.name and extra.version are read by the Meridian facilitator. They are the routing trigger that isBatchPayment() checks. Everything else inside extra is passed through to Circle’s Gateway API verbatim by transformForGateway(), which spreads paymentRequirements and overrides network, asset, and amount only.
The buyer-side SDK sets
paymentRequirements.asset to the Gateway Wallet contract so the EIP-712 domain has the correct verifyingContract. transformForGateway() swaps that back to the network’s USDC address (from NETWORK_USDC) before forwarding to Circle, since Circle expects the actual token address.
Implementation notes
- The facilitator-side glue lives in
apps/facilitator/src/gateway/index.ts. It owns the testnet/mainnet client routing, the Gateway Wallet ↔ USDC asset swap, and the CAIP-2 network mapping that Circle’s API requires. - The deposit/withdraw UI lives in
apps/circle-gatewayand is also hosted atnanopayments.mrdn.finance. - Circle recommends calling
settle()directly for production batched flows rather than the legacyverify()+settle()two-step.
See also
Meridian
- Payment Types
- Settle Batched Payment
- Verify Batched Payment
- Gateway Status
- Roadmap: Circle Nanopayments