x402 V1 → V2 Migration Guide

Field notes from migrating a live, payment-gated API from x402 V1 to V2 on Base mainnet — the undocumented gotchas, working code from a service in production, and a checklist at the bottom.

Written from x402ai, which settles real USDC on Base via the Coinbase CDP facilitator. Every code sample here is running in production, not reconstructed from the spec.

Last verified: July 2026 · @x402/* 2.19.0 · @coinbase/x402 2.1.0

In a hurry? → Migration checklist