Overview
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
x402Clientwith.register()builder pattern 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 the.register()builder pattern - Price recipient: Explicitly specify
payToaddress per route
Schema Declaration
In V2, hand-rollingextensions.bazaar.schema on a route config passes through @x402/core unchanged but fails silently during discovery-crawler verification, because the required envelope fields (type, method, bodyType, body for input; type, example for output) are only populated by the declareDiscoveryExtension() helper from @x402/extensions/bazaar. V1 declared these as config.inputSchema / config.outputSchema and relied on middleware forwarding; V2 requires the helper and spreads its return value into extensions.bazaar. See the Bazaar Discovery Extension documentation for full helper usage.
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)