Documentation Index
Fetch the complete documentation index at: https://docs.prudra.dev/llms.txt
Use this file to discover all available pages before exploring further.
Handle the payment response
After a successful x402 payment, Prudra adds aPAYMENT-RESPONSE header to the 200 response. This header contains settlement details encoded as a base64 JSON object. An agent that needs to verify on-chain settlement should read this header.
The PAYMENT-RESPONSE header
The header value is a base64-encoded JSON string:Response fields
| Field | Type | Description |
|---|---|---|
txHash | string | The on-chain transaction hash. Verify on a Base block explorer. |
settlementPending | boolean | true if the on-chain transaction hasn’t been submitted yet. false if confirmed. |
network | string | The chain where settlement occurred (e.g. "base-mainnet") |
paidAt | string | ISO timestamp when the payment was verified by Prudra |
Settlement timing
x402 settlement is asynchronous. Prudra verifies the ERC-3009 signature before your handler runs, but the on-chain transaction submission happens after the response is sent. Typical flow:- Agent sends
PAYMENT-SIGNATURE - Prudra verifies signature (milliseconds)
- Your handler runs
- Prudra returns 200 with
PAYMENT-RESPONSEheader (settlementPending: trueinitially) - Prudra submits ERC-3009 authorization to Base (seconds later)
- Transaction confirms on Base (~2 seconds)
txHashis now verifiable on-chain
settlementPending is already false by the time the agent reads the response, because Prudra starts settlement immediately after verification.
If settlement fails
If the on-chain transaction fails (rare — this can happen if the authorization expired before submission or gas estimation failed):- The Payment record in Prudra’s database still exists (the signature was valid)
- Prudra’s operations team is automatically notified
- The vault and work output are unaffected
- Contact support@prudra.com with the
txHashfor investigation
Reading the response in the full flow
Related
- How x402 works — the full ERC-3009 settlement flow
- Test x402 payments — run the full test including response parsing
- Replay attack protection — how Prudra prevents double-spending

