Overview
x402 is a payment protocol for HTTP resources. aixyz has built-in x402 support — when a client requests a payment-gated endpoint, the server responds with HTTP 402 and payment requirements. The client includes a payment proof in theX-Payment header, and the server verifies it via a facilitator.
How It Works
- Client requests a gated endpoint (e.g.,
POST /agent) - Server returns HTTP 402 with payment requirements (price, network, payTo address)
- Client constructs payment proof and retries with
X-Paymentheader - Server verifies payment via a facilitator and grants access
The accepts Export
Define payment requirements by exporting accepts from your agent or tool:
With Overrides
"$0.005", "$0.01", "$0.0001".
Per-Agent and Per-Tool Pricing
Agents and tools can each declare their ownaccepts export, enabling granular pricing:
- Agent
acceptsgates the A2A/agentendpoint - Tool
acceptsgates the tool on the MCP/mcpendpoint - Agents and tools without
acceptsare not registered on protocol endpoints
Multiple Payment Options
Accept payment across multiple networks by passing an array of payment entries. This lets clients pay on whichever network they prefer:network is required on each entry so the server can register the correct payment scheme for each network.
All referenced networks are automatically discovered and registered during server initialization — no manual configuration needed beyond the accepts export.
This works for both agents and tools:
Payment Networks
Configure the payment network inaixyz.config.ts:
| Network | CAIP-2 ID |
|---|---|
| Base | eip155:8453 |
| Base Sepolia | eip155:84532 |
| Ethereum | eip155:1 |
Facilitators
Payment verification is handled by a facilitator service:| Facilitator | Activation | URL |
|---|---|---|
| Default | Always available | https://x402.use-agently.com/facilitator |
| Coinbase CDP | When CDP_API_KEY_ID is set | Auto-configured |
| Custom | Set X402_FACILITATOR_URL | Your custom URL |
Custom Facilitator
Createapp/accepts.ts to provide a custom facilitator:
app/accepts.ts
Payer Identity and Sessions
Every verified x402 payment identifies the payer by their wallet address.SessionPlugin (auto-registered by the build pipeline) gives each payer isolated key-value storage accessible via getSession():