x402 SDK Overview
Add HTTP-native payments to your applications using the x402 protocol. Payers sign authorizations—no gas fees required.
What is x402?
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.
How It Works
- Client requests a protected resource
- Server returns
402 Payment Requiredwith payment details - Client signs a payment authorization (no gas)
- Client retries with the signed payment in
PAYMENT-SIGNATUREheader - Server verifies payment via facilitator and returns the resource
Choose Your SDK
npm TypeScript
Express, Hono, Next.js middleware. Fetch/Axios wrappers for clients.
pypi Python
Flask, FastAPI middleware. Requests wrapper for clients.
Supported Networks
Networks use CAIP-2 identifiers:
| Network | CAIP-2 ID | Facilitator |
|---|---|---|
| Base | eip155:8453 |
Primer ✓ |
| Base Sepolia | eip155:84532 |
Primer ✓ |
| Ethereum | eip155:1 |
Custom required |
| Arbitrum | eip155:42161 |
Custom required |
| Optimism | eip155:10 |
Custom required |
| Polygon | eip155:137 |
Custom required |
Token Support
EIP-3009 Tokens (USDC, EURC)
Native gasless transfers via transferWithAuthorization. The payer signs, the facilitator executes—zero gas for the payer.
Standard ERC-20 Tokens
Requires a one-time approval to Primer's Prism contract. After that, payments are gasless via signature authorization.