What it decodes
Paste the headers from curl -i, your browser's network tab or a server log. The decoder finds the payment headers of both protocols and decodes each one:
| Header |
Protocol |
Sent by |
Contains |
WWW-Authenticate: Payment … |
MPP |
server, in the 402 |
one challenge per payment method: id, realm, method, intent, expires and a base64url JSON request with the amount |
Authorization: Payment … |
MPP |
client, on the retry |
base64url JSON credential: the echoed challenge and the method's proof |
Payment-Receipt |
MPP |
server, on success |
base64url JSON receipt with the payment reference |
PAYMENT-REQUIRED |
x402 v2 |
server, in the 402 |
base64 JSON with the resource and an accepts list (network, asset, amount in atomic units, payTo) |
PAYMENT-SIGNATURE |
x402 v2 |
client, on the retry |
base64 JSON payload: the accepted requirement and, for exact on EVM, a signed transfer authorization |
PAYMENT-RESPONSE |
x402 v2 |
server, after settling |
base64 JSON settlement result with the transaction hash |
What it checks
- Expired challenges (
expires) and authorizations (validBefore), which clients and facilitators reject.
- Missing fields that make clients ignore a challenge or a requirement.
- Encoding: MPP requires base64url without padding; a standard base64 value is flagged.
- Payload against requirement for x402: the signed
to and value must match payTo and amount.
- Amounts in human units: cents for card currencies, and 6 decimals for USDC on Base, Base Sepolia, Ethereum and Solana.
- Stripe's card minimum: MPP card payments with Shared Payment Tokens below 0.50 USD are flagged.
- Version 1 leftovers:
X-PAYMENT and maxAmountRequired belong to x402 version 1.
Where 402 integrations go wrong
Decoding shows what was offered. Most production bugs happen after that: an agent retries after a lost response and gets charged twice, two copies of a request both get through, or the handler fails after the money moved. How to charge AI agents per API call with HTTP 402 walks through each case, and Agent Payments handles them for both protocols: a Postgres ledger, exactly-once charging, refunds or unsettled payments when your handler fails, and a budget-capped client for your own agents.
What is HTTP 402 Payment Required?
A status code HTTP reserved for payments; RFC 9110 still lists it as reserved for future use. Agent payment protocols now give it a format: the server answers 402 with what to pay, the client pays and retries the same request with proof.
How do I read a PAYMENT-REQUIRED header?
It is base64-encoded JSON (x402 version 2) with x402Version, the resource and an accepts list. Each entry names a scheme (such as exact), a CAIP-2 network (eip155:8453 is Base), the asset contract, the amount in the asset's atomic units (USDC has 6 decimals, so 10000 is 0.01 USDC) and the payTo address.
How do I read an MPP WWW-Authenticate: Payment challenge?
Its parameters are plain text except request, which is base64url-encoded JSON (no padding) with the amount, the currency and method details. For Stripe card payments the amount is in minor units, so 75 with currency usd is 0.75 USD.
Does the decoder send my headers anywhere?
No. It runs in your browser and makes no network requests. Payment credentials can be single-use tokens, so still avoid pasting live ones into tools you don't control.