v2 is now the recommended version. While v1 continues to work, we encourage all users to migrate to v2 for the latest features and improvements.
Official v2 Specification: The authoritative protocol specification is at github.com/x402-foundation/x402/specs. For CDP facilitator API schemas, see the x402 Facilitator API Reference.
Overview
Compatibility Matrix
Use this matrix to understand which SDK versions work with which facilitators and protocol versions.SDK Packages
Legacy (designed for v1)
Current (use v2 by default)
Facilitators
Headers
v2 libraries check for both v1 and v2 headers for backward compatibility, but new implementations should use v2 headers.
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
Package Migration Reference
- TypeScript
- Python
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)