Overview
| Aspect | V1 | V2 |
|---|---|---|
| Payment Header | X-PAYMENT | PAYMENT-SIGNATURE |
| Response Header | X-PAYMENT-RESPONSE | PAYMENT-RESPONSE |
| Network Format | String (base-sepolia) | CAIP-2 (eip155:84532) |
| Version Field | x402Version: 1 | x402Version: 2 |
| Packages | x402, x402-express, x402-axios | @x402/core, @x402/express, @x402/axios, @x402/evm |
For Buyers
Before (V1)
- TypeScript
- Python
After (V2)
- TypeScript
- Python
Key Changes
- TypeScript
- Python
- Package rename:
x402-axios→@x402/axios - Function rename:
withPaymentInterceptor→wrapAxiosWithPayment - Wallet setup: Use
x402ClientwithregisterExactEvmSchemehelper instead of passing wallet directly - No chain-specific configuration: The V2 client automatically handles network selection based on payment requirements
For Sellers
Before (V1)
- TypeScript
- Python
After (V2)
- TypeScript
- Python
Key Changes
- TypeScript
- Python
- Package rename:
x402-express→@x402/express - Configuration structure: Route config now uses
acceptsarray with explicitscheme,network, andpayTo - Network format:
base-sepolia→eip155:84532(CAIP-2 standard) - Resource server: Create
x402ResourceServerwith facilitator client and register schemes using helper functions - Price recipient: Explicitly specify
payToaddress per route
Network Identifier Mapping
| V1 Name | V2 CAIP-2 ID | Chain ID | Description |
|---|---|---|---|
base-sepolia | eip155:84532 | 84532 | Base Sepolia Testnet |
base | eip155:8453 | 8453 | Base Mainnet |
ethereum | eip155:1 | 1 | Ethereum Mainnet |
sepolia | eip155:11155111 | 11155111 | Ethereum Sepolia Testnet |
solana-devnet | solana:devnet | - | Solana Devnet |
solana | solana:mainnet | - | Solana Mainnet |
Package Migration Reference
- TypeScript
- Python
| V1 Package | V2 Package(s) |
|---|---|
x402 | @x402/core |
x402-express | @x402/express |
x402-axios | @x402/axios |
x402-fetch | @x402/fetch |
x402-hono | @x402/hono |
x402-next | @x402/next |
| (built-in) | @x402/evm (EVM support) |
| (built-in) | @x402/svm (Solana support) |
Header Changes
If you’re implementing custom HTTP handling, update your header names:- TypeScript
- Python
Troubleshooting
- TypeScript
- Python
Payment verification failures
- Check you’re using CAIP-2 network identifiers (
eip155:84532notbase-sepolia) - Verify your
payToaddress is correctly configured - Ensure the facilitator URL is correct for your network (testnet vs mainnet)