Use this page to read or debug x402 traffic: the three headers of one real payment, captured on LocalNet with x402-algorand 0.3.0 and the official x402 2.28.0 SDK: a FastAPI route GET /weather priced at 10,000 microALGO, protected by payment_middleware with an in-process facilitator whose account is both payTo and fee payer (the setup on FastAPI). The buyer paid with x402Client and PayerAvmSigner. Addresses, the LocalNet network id and transaction ids differ on every machine and run. The headers are defined by the x402 HTTP transport (v2), their JSON objects by the x402 v2 specification, and the Algorand-specific parts by the exact scheme on Algorand. Each header value is standard base64 of UTF-8 JSON. Decode it with json.loads(base64.b64decode(value)) in Python, decodePaymentRequired(value) in x402-avm-js, or decode_payment_required_header / decode_payment_signature_header / decode_payment_response_header from x402.http.

1. The 402 response

The unpaid request GET /weather returned:
Decoded PAYMENT-REQUIRED:

From a PaymentGate MCP server

A tools/call posted to a PaymentGate server (POST /mcp, Streamable HTTP) without payment gets the same kind of 402. The decoded header captured from a server built like the Quickstart server (here on port 9303, echo at 5,000 microALGO) differs in these fields:
extra.genesisHash and extra.genesisId are optional hints added by x402-algorand’s server scheme when the network is registered (as ai-economy-sdk does for "localnet", and as MainNet and TestNet always are). x402-avm-js 0.4.0 refuses to pay a requirement whose hints disagree with its algod (NetworkMismatchError).

2. The paid retry

The client retried GET /weather with a PAYMENT-SIGNATURE header. Decoded:
The two transactions, decoded with algosdk.encoding.msgpack_decode (msgpack field names): The notes make each group, and so each payment hash, unique. What the facilitator checks before it signs transaction 0 is listed on AVM exact scheme.

3. The 200 response

The facilitator verified the group, the route ran, and the middleware settled the payment:
Decoded PAYMENT-RESPONSE:
The buyer’s balance fell by exactly 10,000 microALGO; the fee payer paid the 2,000 microALGO fee.

From a PaymentGate MCP server

On Streamable HTTP, the paid tools/call returns 200 with content-type: text/event-stream, the JSON-RPC result in the body, and a PAYMENT-RESPONSE header of the same shape. The header is only sent when the tool succeeded and the payment settled: a failed tool returns an MCP error result and nothing is submitted. Sending the same PAYMENT-SIGNATURE again after it settled returns 402 with {"error":"transaction_simulation_failed"}: the group is already on chain, so it fails verification. A duplicate sent while the first use is still in progress gets 402 with {"error":"Replay detected"}.

Reproduce it

Run the FastAPI paywall on LocalNet, then:
For the paid side, use the HTTPX client and print response.headers["payment-response"] the same way.