# x402 v1 vs v2: what changed and how to migrate

> How to tell whether an x402 endpoint speaks v1 or v2, where the payment challenge moved, why invalid_payload fills a v1 server's logs, and how to migrate.

Published 2026-11-01. Source: https://toolvet.app/blog/x402-v1-vs-v2-migration

**Short answer:** x402 v2 moved the payment challenge out of the `402` response body into a base64 `PAYMENT-REQUIRED` header, renamed the client's `X-PAYMENT` header to `PAYMENT-SIGNATURE` and the server's `X-PAYMENT-RESPONSE` to `PAYMENT-RESPONSE`, switched network names such as `base` to CAIP-2 identifiers such as `eip155:8453`, and moved the SDKs from `x402-*` to the scoped `@x402/*` packages. The facilitator accepts both versions and a v2 server still takes v1 payments, so nothing stops working the day you upgrade. What does happen is that a v1 server meets v2 clients that put their payment where it doesn't look, and logs `invalid_payload` or counts the request as unpaid. One `curl` tells you which version an endpoint speaks, and the migration is a list of mechanical edits. This post goes through them, as of 1 November 2026.

Some background: v2 was [announced on 11 December 2025](https://www.x402.org/writing/x402-v2-launch) as a restructuring without breaking changes, "fully backward-compatible with V1" at the SDK level, and the reference implementation has since moved to the x402 Foundation's [`x402-foundation/x402`](https://github.com/x402-foundation/x402) repository (the TypeScript core changelog records the move in 2.9.0). The [official migration guide](https://docs.x402.org/guides/migration-v1-to-v2.md) has the code; this post adds what the guide leaves out, which is how the two versions look on the wire and what goes wrong when they meet. ToolVet parses both formats when it checks a listed endpoint, and the free [x402 checker](https://toolvet.app/check) reports the version as one of its nine checks ([how we check and score](https://toolvet.app/methodology)).

## What changed on the wire

| | v1 | v2 |
|---|---|---|
| Where the challenge is | JSON body of the `402` | `PAYMENT-REQUIRED` header, base64 JSON; body left to the server (the spec's example is `{}`) |
| Client's payment header | `X-PAYMENT` | `PAYMENT-SIGNATURE` |
| Server's receipt header | `X-PAYMENT-RESPONSE` | `PAYMENT-RESPONSE` |
| Version field | `x402Version: 1` | `x402Version: 2` |
| Network | `base`, `base-sepolia` | `eip155:8453`, `eip155:84532` |
| Price field | `maxAmountRequired` | `amount` |
| Resource, description, MIME type | inside each `accepts` entry | one top-level `resource` object with `url`, `description`, `mimeType` |

The headers and the body rule come from the [v2 HTTP transport spec](https://raw.githubusercontent.com/x402-foundation/x402/main/specs/transports-v2/http.md), which calls `PAYMENT-REQUIRED` "the canonical HTTP transport location for the `PaymentRequired` object" and says "Response bodies are a server implementation concern." The field changes come from the [v1](https://github.com/coinbase/x402/blob/main/specs/x402-specification-v1.md) and [v2](https://github.com/coinbase/x402/blob/main/specs/x402-specification-v2.md) core specifications. In v1 each entry in `accepts` carried its own `resource`, `description` and `mimeType` and the required fields were `scheme`, `network`, `maxAmountRequired`, `asset`, `payTo`, `resource`, `description` and `maxTimeoutSeconds`. In v2 an entry is `scheme`, `network`, `asset`, `amount`, `payTo`, `maxTimeoutSeconds` and an optional `extra`, and the resource is described once. The client's payload changed shape too: v1 sent `{x402Version, scheme, network, payload}`, v2 sends `{x402Version, resource, accepted, payload, extensions}`, where `accepted` is the whole requirements entry the client chose. The payload itself (an EIP-712 signature over an EIP-3009 authorization with `from`, `to`, `value`, `validAfter`, `validBefore`, `nonce`) is the same.

The network mapping from the migration guide:

| v1 | v2 (CAIP-2) |
|---|---|
| `base` | `eip155:8453` |
| `base-sepolia` | `eip155:84532` |
| `ethereum` | `eip155:1` |
| `sepolia` | `eip155:11155111` |
| `solana` | `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` |
| `solana-devnet` | `solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1` |

The Python SDK's [2.26.0 release](https://github.com/x402-foundation/x402/blob/main/python/x402/CHANGELOG.md) on 28 October 2026 added a check to "Reject malformed V2 network identifiers that do not match CAIP-2 syntax", so a v2 config that still says `base` is refused instead of failing at the first payment.

## Which version is this endpoint speaking?

Send the unpaid request and look at the headers:

```bash
curl -si https://api.example.com/paid \
  | grep -i '^payment-required:' | cut -d' ' -f2 | tr -d '\r' | base64 --decode
```

If that prints JSON with `"x402Version":2`, the endpoint is v2. If `grep` finds nothing and the body of the `402` is JSON with `"x402Version":1` and `maxAmountRequired` inside `accepts`, it is v1. The [checker](https://toolvet.app/check) does the same and marks the version check as passing only for a v2 header; a v1 challenge still parses, prices and lists, but the fix text tells the owner to upgrade. Catalogs are stricter in places: one developer's [migration notes](https://dev.to/ukenal/migrating-a-live-x402-service-from-v1-to-v2-on-base-mainnet-1mg9) from July 2026 report that submitting a v1 origin to x402scan produced a rejection saying a v1 response was detected and the service should migrate.

## Why a v1 server sees `invalid_payload`

`invalid_payload` is one of the error reasons the core spec defines, alongside `invalid_x402_version`, `invalid_network`, `unsupported_scheme` and the rest. On a v1 server it tends to mean something specific. A v2 client reads the `402`, finds no `PAYMENT-REQUIRED` header, and either gives up or, if it also understands v1 bodies, pays and sends `PAYMENT-SIGNATURE`. The v1 middleware looks for `X-PAYMENT`, finds nothing, and treats the request as unpaid, or finds a v2-shaped payload where it expected a v1 one and logs `invalid_payload` without saying why. The same developer notes describe exactly this: weeks of `invalid_payload` entries from "V2-capable clients attempting payment against V1 middleware", recognised only after the fact. The checklist in those notes starts with "Confirm you're on V1 (check for `invalid_payload` errors in your logs)".

The reverse direction is friendlier. The migration guide says a v2 server "can still accept payments from V1 clients" and "the facilitator supports both V1 and V2 protocols". SDKs that handle both look for the v2 header first: thirdweb's [v2 changelog](https://portal.thirdweb.com/changelog/support-for-x402-protocol-v2) from 13 January 2026 says "Payment data retrieval now prioritizes v2 headers with fallback to v1", and the Python SDK's 2.26.0 release notes that its "HTTP resource server now rejects V1 payloads in the `PAYMENT-SIGNATURE` header with a 402 instead of failing with a 500". If you run a dual-version endpoint for browsers, the transport spec's CORS note applies: name `X-PAYMENT` next to `PAYMENT-SIGNATURE` in `Access-Control-Allow-Headers` and `X-PAYMENT-RESPONSE` next to `PAYMENT-RESPONSE` in `Access-Control-Expose-Headers`, because "a dual-version endpoint that names only one spelling fails the same way for the other version's clients".

## The migration, step by step

The [guide](https://docs.x402.org/guides/migration-v1-to-v2.md) covers TypeScript and Python. The steps, condensed:

1. **Packages.** `x402` becomes `@x402/core`; `x402-express`, `x402-hono`, `x402-next`, `x402-axios` and `x402-fetch` become `@x402/express`, `@x402/hono`, `@x402/next`, `@x402/axios` and `@x402/fetch`; chain support moves into `@x402/evm` and `@x402/svm`. Python keeps the `x402` package but moves the import paths: `x402.fastapi.middleware` is now `x402.http.middleware.fastapi`, `x402.clients.httpx` is `x402.http.clients`, and the extras are `x402[httpx]`, `x402[requests]`, `x402[fastapi]`, `x402[flask]` and `x402[svm]`. Upgrade the `@x402/*` packages together, to one version.
2. **Server wiring.** Create an `x402ResourceServer` around an `HTTPFacilitatorClient` and register a scheme explicitly: `server.register("eip155:*", new ExactEvmScheme())`. Python's `require_payment` function becomes the `PaymentMiddlewareASGI` class with `RouteConfig` and `PaymentOption` models; Flask uses `x402ResourceServerSync` and `HTTPFacilitatorClientSync`.
3. **Route config.** Routes are keyed by method and path, for example `"GET /paid"`, each with an `accepts` array naming `scheme`, `network` (CAIP-2) and `payTo` per option, and `description` and `mimeType` as siblings of `accepts` rather than inside it. The migration notes add one thing the guide doesn't: v2 no longer reads `X-Forwarded-Proto`, so behind a TLS-terminating proxy the advertised resource URL can revert to `http://` unless you set an explicit `resource` on each paid route. ToolVet's checker has a separate check for exactly that, and [an `http://` resource URL is one of the seven reasons a listing never reaches the Bazaar](https://toolvet.app/blog/x402-endpoint-not-in-bazaar).
4. **Client wiring.** `withPaymentInterceptor` from `x402-axios` is now `wrapAxiosWithPayment` from `@x402/axios`, around an `x402Client` with `.register("eip155:*", new ExactEvmScheme(signer))`; the client picks the network from the challenge, so no chain config is needed. Python wraps the account in `EthAccountSigner` and calls `register_exact_evm_client`; the environment variable in the examples changed from `PRIVATE_KEY` to `EVM_PRIVATE_KEY`.
5. **Bazaar metadata.** In v1 the input and output schemas went in `config.inputSchema` and `config.outputSchema`. In v2 use `declareDiscoveryExtension()` from `@x402/extensions/bazaar` and spread the result into `extensions.bazaar`; a hand-written `extensions.bazaar.schema` "passes through `@x402/core` unchanged but fails silently during discovery-crawler verification", which is a quiet way to stay out of the catalog.
6. **Test with one real payment.** The guide's troubleshooting section blames most verification failures on a network string that isn't CAIP-2, a wrong `payTo`, or a facilitator URL that doesn't match the network; [Stripe's x402 guide](https://docs.stripe.com/payments/machine/x402) calls `https://x402.org/facilitator` the "public test facilitator" for Base Sepolia, so it won't settle mainnet. The transaction hash comes back in the `transaction` field of the `PAYMENT-RESPONSE` header, per the transport spec.

Two more reasons not to stay on a v1 package line, both from the TypeScript [core changelog](https://github.com/x402-foundation/x402/blob/main/typescript/packages/core/CHANGELOG.md): 2.27.0 closed a paywall bypass by matching protected routes against both the escaped and the decoded request path, and 2.26.0 passes the resolved `spendControls` cap to every scheme. The changelogs list these fixes under the scoped packages; the [three SDK flaws disclosed on 22 October 2026](https://toolvet.app/blog/x402-sdk-vulnerabilities-spending-limits) had been fixed there in August's 2.23.0, and nothing in the changelogs says a `x402-*` 1.x line received them.

## Checklist

For sellers: run the `curl` above against your own endpoint; if the challenge is in the body, you are on v1. Upgrade the packages together, rewrite the route config, set an explicit `resource` per route, declare the Bazaar extension with the helper, keep the `402` ahead of any input validation (the migration notes recommend the opposite order, but [a `400` before the paywall keeps you out of the Bazaar](https://toolvet.app/blog/x402-endpoint-not-in-bazaar)), and confirm one settlement on mainnet. Then put the URL into the [checker](https://toolvet.app/check) and look for passes on the version, resource URL and discovery schema checks.

For buyers and agent builders: use a client that reads `PAYMENT-REQUIRED` first and falls back to a v1 body, send `PAYMENT-SIGNATURE`, and treat a `402` whose `PAYMENT-RESPONSE` says `success: false` as a failed payment rather than a new challenge. The [seven challenge checks](https://toolvet.app/blog/x402-payment-challenge-checks) apply to both versions; the version itself is the first of them.

## Frequently asked questions

### How do I know if an x402 endpoint is v1 or v2?

Send an unpaid request. A v2 endpoint answers `402` with a `PAYMENT-REQUIRED` header holding base64 JSON with `"x402Version": 2`; the body is left to the server (the spec's example is `{}`). A v1 endpoint answers `402` with the challenge as JSON in the body, `"x402Version": 1` and `maxAmountRequired` inside `accepts`. ToolVet's free checker reports this as its version check.

### Does a v2 server still accept v1 clients?

Yes. The official migration guide says a v2 server "can still accept payments from V1 clients" and that the facilitator supports both versions. The other direction is the problem: a v1 server doesn't read `PAYMENT-SIGNATURE`, so v2 clients are treated as unpaid or logged as `invalid_payload`.

### What does invalid_payload mean in x402?

It is the error reason for a payment payload the server or facilitator can't parse or verify. On a v1 server the usual cause is a v2 client sending a v2-shaped payload, or sending it in the `PAYMENT-SIGNATURE` header the v1 middleware doesn't read. On a v2 server, check that the network is in CAIP-2 form and that the client's `accepted` entry matches one of the server's `accepts`.

### Do I have to change my network names?

Yes, for v2: `base` becomes `eip155:8453`, `base-sepolia` becomes `eip155:84532`, and Solana mainnet becomes `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`. Since the Python SDK's 2.26.0 release on 28 October 2026, v2 network IDs that aren't CAIP-2 are rejected.

The specifications, migration guide and changelogs quoted above were read on 1 November 2026. [How we check and score](https://toolvet.app/methodology) explains how ToolVet parses v1 and v2 challenges when it checks a listed endpoint.
