Skip to main content
This guide helps you migrate from x402 v1 to v2. The v2 protocol introduces standardized identifiers, improved type safety, and a more modular architecture.
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)

After (v2)

Key Changes

  1. Package rename: x402-axios@x402/axios
  2. Function rename: withPaymentInterceptorwrapAxiosWithPayment
  3. Wallet setup: Use x402Client with registerExactEvmScheme helper instead of passing wallet directly
  4. No chain-specific configuration: The v2 client automatically handles network selection based on payment requirements

For Sellers

Before (v1)

After (v2)

Key Changes

  1. Package rename: x402-express@x402/express
  2. Configuration structure: Route config now uses accepts array with explicit scheme, network, and payTo
  3. Network format: base-sepoliaeip155:84532 (CAIP-2 standard)
  4. Resource server: Create x402ResourceServer with facilitator client and register schemes using helper functions
  5. Price recipient: Explicitly specify payTo address per route

Network Identifier Mapping

Package Migration Reference

Header Changes

If you’re implementing custom HTTP handling, update your header names:

Troubleshooting

”Cannot find module” errors

Ensure you’ve installed all v2 packages:

Payment verification failures

  • Check you’re using CAIP-2 network identifiers (eip155:84532 not base-sepolia)
  • Verify your payTo address is correctly configured
  • Ensure the facilitator URL is correct for your network (testnet vs mainnet)

Mixed v1/v2 compatibility

The facilitator supports both v1 and v2 protocols. During migration, your v2 server can still accept payments from v1 clients, but we recommend updating clients to v2 for full feature support.

Next Steps