X-PAYMENT-RESPONSE
ResponseX-PAYMENT-RESPONSE is the x402 response header returned alongside a successful 200 response after payment verification. It contains a base64-encoded JSON receipt confirming the payment was verified, the transaction hash, and the settlement timestamp.
Description
X-PAYMENT-RESPONSE is the receipt header. After the facilitator confirms the payment is valid, the server grants access and includes X-PAYMENT-RESPONSE in the 200 response. The client can store this receipt for auditing, deduplication, and proof of payment.
The receipt includes: success boolean, the verified transaction hash, the network where settlement occurred, and a settled timestamp. The client should log X-PAYMENT-RESPONSE alongside the resource response for accounting purposes.
If payment verification fails (invalid transaction, replay attempt, amount mismatch), the server returns a new 402 with a PAYMENT-REQUIRED header describing the failure, not a X-PAYMENT-RESPONSE.
Format
Base64(JSON): {success: boolean, txHash: string, network: string, settledAt: string}
HTTP/1.1 200 OK
Content-Type: application/json
X-PAYMENT-RESPONSE: eyJzdWNjZXNzIjp0cnVlLCJ0eEhhc2giOiIweGFiY2RlZjEyMzQ1Njc4OTAiLCJuZXR3b3JrIjoiYmFzZSIsInNldHRsZWRBdCI6IjIwMjYtMDEtMTVUMTA6MDA6MTBaIn0=
{"data":"Premium content..."}