Networks and settlement

Batch settlementPreview

Clients deposit once, then pay for each request with a signed voucher instead of an onchain transaction. Built for frequent, low-priced calls.

Batch settlement is rolling out gradually. If your 402 responses don’t include a batch-settlement option yet, it is not enabled for your environment.

When to use it

Standard x402 payments settle every request onchain. That works well for occasional calls, but when an agent makes many calls priced at a fraction of a cent, a transaction per call adds time and cost that can outweigh the price itself. Batch settlement takes the per-request payment offchain and pays you out in bulk.

Standard paymentsBatch settlement
Onchain transactionsOne per requestOne deposit, then periodic payouts
Client is chargedBefore your backend runsAfter your backend succeeds
Per-request paymentSettled onchainSigned voucher, checked instantly
Best forOccasional calls, higher pricesFrequent calls, tiny prices

How it works

  1. The client deposits once

    The client’s first paid request includes a deposit, for example $2 of USDC. The deposit is held in escrow for your recipient address. The client pays no network fee for it, so it only needs USDC.

  2. Each request carries a voucher

    Every later request includes a signed voucher with the running total the client has spent. AgentPay checks the voucher against the deposit without waiting on the chain, so payment adds no settlement delay to the request.

  3. Your backend runs first

    AgentPay forwards the request to your backend. The charge is recorded only if your backend responds successfully. If it returns an error (status 400 or higher), the charge is released and the client is not billed for that request.

  4. Vouchers are paid out in batches

    About every 10 minutes, AgentPay collects outstanding vouchers and pays the total out of escrow to your recipient address.

  5. Unused balance stays with the client

    The rest of the deposit remains available for future requests. The client can ask for a refund of the unused balance at any time.

Where funds go

Deposits sit in escrow, not with AgentPay. Payouts go directly from escrow to the recipient address configured on your x402 channel. AgentPay never holds the funds.

A client can also withdraw its balance on its own. Withdrawals take effect after a 24-hour waiting period, which gives AgentPay time to pay out every request you already served.

Supported networks

NetworkChannelAsset
Basex402USDC
Polygonx402USDC
Base Sepoliax402 TestnetUSDC

Batch settlement is not available on Solana or for ETH payments. Clients on those keep using standard payments. See Supported networks for every network and option.

Enabling it

There is nothing extra to configure. When your x402 or x402 Testnet channel accepts USDC on a supported network, AgentPay adds a batch-settlement option to the 402 response next to the standard option, with the same price and recipient. Clients that don’t support batch settlement keep using the standard option.

Client integration

Clients need an x402 client that supports the batch-settlement scheme. In the 402 response, the option looks like this:

accepts entry (excerpt)
{
  "scheme": "batch-settlement",
  "network": "eip155:8453",
  "amount": "100",
  "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  "payTo": "0xYourRecipientAddress"
}
  • The first request sends a deposit. Later requests send vouchers in the PAYMENT-SIGNATURE header. When the balance runs low, the client deposits again.
  • If the client’s running total falls out of sync, for example after a failed request, AgentPay replies with a 402 that includes the total it has on record, so the client can correct the voucher and retry.
  • Voucher responses carry no transaction hash, because nothing is posted onchain for that request. The response to a deposit includes the deposit transaction.