Preview
Flow
1
Seller registers paywalled endpoints
The Next.js app exposes x402-protected premium routes priced from 0.03 USDC per request, using Circle Nanopayments middleware to enforce
payment before serving content.
2
Buyer agent deposits USDC through Gateway
The LangChain buyer agent checks its wallet balance and deposits USDC into
Circle Gateway. Gateway aggregates the USDC into a nanopayments balance the
agent draws from for each request, so the agent settles against its Gateway
balance rather than submitting a separate onchain transaction per call.
3
Agent requests a paywalled endpoint
The agent sends an HTTP request to a premium route. The server responds with
a
402 Payment Required status and a payment challenge header (an
x402 standard header that specifies the payment amount,
token, and receiving address on Arc).4
Agent pays the x402 challenge
The agent constructs and signs a USDC payment transaction on Arc to satisfy
the payment challenge. The signed transaction hash is attached to the retry
request as the payment proof in the
X-Payment header.5
Seller verifies and serves content
The Nanopayments middleware verifies the payment onchain, then serves the
premium response. The payment event is recorded in Supabase.
6
Seller dashboard updates in real time
Supabase Realtime pushes new payment events to the seller dashboard.
Accumulated earnings are available to withdraw via the Gateway UI.
Tech stack
- Next.js App Router for the seller app and seller dashboard
- Circle Nanopayments with x402 for per-request API monetization
- Circle Gateway for buyer USDC deposits and seller withdrawals
- LangChain and DeepAgents for the autonomous buyer agent
- Viem for wallet interactions and onchain payment signing
- Supabase for payment event persistence and real-time dashboard updates
- Tailwind CSS and shadcn/ui for the seller interface