x402 FACILITATOR & SDK
HTTP-native payments for AI agents
x402 is an open payment standard based around the HTTP 402 status, meaning Payment Required. This is in the same family as 404; Not Found. HTTP status codes were introduced in the 1990's, with 402 being intended for a then-unknown future payment system. In 2025, x402 unlocked this potential, allowing for gasless, instant settlement of agent-to-agent payments of any size.
Primer expands on the basic x402 offering with full ERC-20 support via the Prism router.
Payment Flow
1. Client requests resource, server returns HTTP 402 + payment requirements
2. Client signs EIP-712 authorization (no tx, just signature)
3. Facilitator verifies signature, settles on-chain, sponsors gas
4. Server delivers resource with tx receipt
Read more: x402.org
EIP-3009 (Direct): USDC, EURC, PR - native transferWithAuthorization, no approval needed
ERC-20 (Prism): USDT, wBTC, any token - one-time approval to Prism router, then gasless
x402 v2 uses CAIP-2 network identifiers:
| Network | CAIP-2 ID | Facilitator |
|---|---|---|
| Base | eip155:8453 |
Primer ✓ |
| Base Sepolia | eip155:84532 |
Primer ✓ |
| Ethereum | eip155:1 |
Custom |
| Arbitrum | eip155:42161 |
Custom |
| Optimism | eip155:10 |
Custom |
| Polygon | eip155:137 |
Custom |
Primer facilitator is free for Base. Other networks require custom facilitator.
Wrap fetch or axios to auto-handle 402 responses:
const { createSigner, x402Fetch } = require('@primersystems/x402') // Create signer (CAIP-2 network format) const signer = await createSigner('eip155:8453', process.env.PRIVATE_KEY) // Wrap fetch (or use x402Axios for axios) const fetch402 = x402Fetch(fetch, signer, { maxAmount: '1.00' }) const res = await fetch402('https://example.com/api/premium')
Middleware for Express, Hono, and Next.js:
const { x402Express } = require('@primersystems/x402') app.use(x402Express('0xYourAddress', { '/api/premium': { amount: '0.01', asset: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', // USDC network: 'eip155:8453' // Base } })) // Also: x402Hono, x402Next
Base URL: https://x402.primer.systems
| Endpoint | Method | Description |
|---|---|---|
/verify |
POST | Verify payment signature without executing |
/settle |
POST | Settle payment on-chain |
/supported |
GET | List supported networks and tokens |
/health |
GET | Facilitator status |
/contracts |
GET | Prism router addresses |
Base Mainnet: 0x402357ff1e18d42d0f14a5d56d6e1ebd741b3a86
Base Sepolia: 0x402357ff1e18d42d0f14a5d56d6e1ebd741b3a86