PayGate402 · Circle Arc Testnet

Turn any API into an agent-payable storefront

A drop-in withPaywall() wrapper that makes any HTTP route return HTTP 402 and accept sub-cent USDC payments from autonomous agents — settled via Circle Gateway batching on Arc, where USDC is the native gas token. No accounts, no API keys: payment is identity.

→ Seller revenue dashboardchain 5042002faucet.circle.com

Paywalled endpoints

MethodEndpointPriceDescription
POST/api/premium/summarize$0.002Summarize text (heuristic, or LLM if OPENAI_API_KEY is set).
POST/api/premium/keywords$0.001Extract top keywords from text.
GET/api/premium/fx-rate$0.0005Indicative USDC↔EURC rate (wire to Arc StableFX for real quotes).

Try the 402 (no payment)

Any unpaid request returns 402 Payment Required with a base64 PAYMENT-REQUIRED header describing how to pay:

# Unpaid GET -> 402 + PAYMENT-REQUIRED header
curl -i http://localhost:3000/api/premium/fx-rate

# Unpaid POST -> 402
curl -i -X POST http://localhost:3000/api/premium/summarize \
  -H 'content-type: application/json' \
  -d '{"text":"Arc is an L1 where USDC is the gas token..."}'

Pay for it (autonomous agent)

The buyer agent funds an ephemeral wallet, deposits into Circle Gateway, then signs offchain authorizations to pay each endpoint — with a hard spend cap:

npm run generate-wallets          # creates seller + buyer wallets
# fund BUYER_ADDRESS at https://faucet.circle.com (Arc Testnet, USDC)
npm run dev                       # this app (the seller)
npm run agent -- --limit 0.5      # buyer agent pays until 0.5 USDC spent

Testnet only. Built on Circle's @circle-fin/x402-batching; structure adapted from circlefin/arc-nanopayments.