Skip to main content
The Nanopayments Gateway is Meridian’s integration of Circle Gateway nanopayments. The buyer funds a unified USDC balance once on any supported chain, then makes many gas-free, sub-cent ($0.000001 minimum) payments that Circle batches into a single onchain settlement. Each individual x402 payment is verified instantly by signature, while Circle’s Gateway System aggregates the signed authorizations and settles net positions in bulk. The Meridian facilitator wraps Circle’s @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.
The buyer never submits an on-chain transaction at payment time. Funds move from their pre-funded Gateway Wallet balance through Circle’s batched settlement. Withdrawals from the Gateway Wallet are subject to a 7-day delay enforced by the Gateway Wallet contract.

Detection

A payment is routed through the Nanopayments Gateway when both of these are present in paymentRequirements.extra:
This check is performed by 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.
Networks listed in the facilitator’s CAIP-2 map are not currently supported by Circle’s Gateway API for nanopayments, including bsc, fluent-testnet, ink, megaeth, and tempo. The facilitator will forward the request, but Circle will reject it. See Circle’s Gateway Supported Blockchains for the authoritative list (column Nanopayments: Yes). Networks marked with [!] below are configured locally but not yet supported by 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 to BatchFacilitatorClient).
  • Mainnet: the default URL baked into @circle-fin/x402-batching/server. The facilitator constructs new BatchFacilitatorClient() with no url override.
Both clients are lazy-initialized singletons.

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

  1. USDC.approve(gatewayWallet, value). One-time per source chain.
  2. GatewayWallet.deposit(usdcAddress, value). Pulls USDC and credits the depositor’s balance. Circle also exposes depositFor, depositWithPermit, and depositWithAuthorization on the wallet contract.
  3. After the deposit transaction is finalized onchain, the credit becomes part of availableBalance and can be spent. Time-to-finality is chain-specific: Source: Circle’s Required block confirmations table.
Sending USDC to the Gateway Wallet via a plain ERC-20 transfer instead of one of the deposit methods will result in loss of funds. Always call a deposit* method on the wallet contract.

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 withdrawalBlock value on the Gateway Wallet contract.
The hosted Nanopayments Gateway UI currently exposes the trustless path:
  1. GatewayWallet.initiateWithdrawal(usdc, value). Moves balance from availableBalance to withdrawingBalance and records withdrawalBlock.
  2. After block.number >= withdrawalBlock, call GatewayWallet.withdraw(usdc). Moves the unlocked amount from withdrawableBalance back to the buyer’s wallet.
Source: Circle’s Withdrawal documentation.

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-gateway and is also hosted at nanopayments.mrdn.finance.
  • Circle recommends calling settle() directly for production batched flows rather than the legacy verify() + settle() two-step.

See also

Meridian

Circle (authoritative source for the upstream API and contracts)