Guide · Intermediate · 2026
x402 v1 vs v2: what changed and how not to crash a tester
x402 V2 shipped in December 2025. V2 is the recommended baseline in 2026. Older tutorials still show V1 shapes. Mixing them is the fastest way to fail a 402 checker or a modern client.
Quick comparison
| Aspect | V1 | V2 |
|---|---|---|
| Version field | x402Version: 1 | x402Version: 2 |
| Payment header (client → server) | X-PAYMENT | PAYMENT-SIGNATURE (often still accept X-PAYMENT) |
| Requirements header (server → client) | mostly body only | PAYMENT-REQUIRED (base64) + body |
| Response header | X-PAYMENT-RESPONSE | PAYMENT-RESPONSE (+ legacy mirror OK) |
| Network id | strings like base-sepolia, solana-devnet | CAIP-2: eip155:84532, solana:EtWTRAB… |
| Resource metadata | often inside each accepts[] item | top-level resource { url, description, mimeType } |
| Amount field | maxAmountRequired | amount (+ keep maxAmountRequired for compat) |
| Packages | x402, x402-express, … | @x402/core, @x402/express, @x402/svm, … |
Solana CAIP-2 IDs you will actually use
- Devnet:
solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1 - Mainnet:
solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp
Some docs still show shorthand like solana:devnet. Prefer the genesis-hash form from current docs.x402.org and re-check before production.
What breaks testers
- Advertising
solana-devnetwhile a V2-only client expects CAIP-2. - Returning 200 with no payment middleware (looks “open,” grade fails).
- Missing
payTo, emptyaccepts[], or wrong address format (0x on Solana). - Using the public test facilitator URL on mainnet.
- Clients sending only
X-PAYMENTto a server that only readsPAYMENT-SIGNATURE(or the reverse). Accept both during migration.
Compat recipe used on this site
Our lab and donate endpoints advertise v2 envelopes and still mirror useful v1 fields:
- Top-level
resource+x402Version: 2 amountand legacymaxAmountRequired- CAIP-2
networkin accepts - Accept inbound proofs with either modern headers or
X-PAYMENT
That way humans, older scripts, and current agents can all complete the loop.
Migration checklist
- Bump packages to
@x402/*v2 line. - Switch middleware to routes-config +
x402ResourceServer+ scheme register (ExactSvmScheme / ExactEvmScheme). - Replace network strings with CAIP-2.
- Add PAYMENT-* headers; keep X-* during a transition window.
- Validate with the 402 Checker and a known-good endpoint like this site’s donate route.
Always re-check docs.x402.org before production — package APIs evolve. Ship x402 is independent and not financial advice.