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.
x402 payments
x402 is an open payment protocol built on HTTP 402 status codes. When a Prudra-protected endpoint returns 402, it includes aPAYMENT-REQUIRED header containing the payment options in base64-encoded JSON. The agent decodes this header, signs an ERC-3009 authorization off-chain, and resubmits with the signature in the PAYMENT-SIGNATURE header.
The agent’s wallet never sends a transaction directly. Prudra’s server receives the signed authorization, verifies it cryptographically, does the work, then settles on-chain. The agent pays with a signature — Prudra handles the blockchain interaction.
How the challenge works
ThePAYMENT-REQUIRED header contains a base64-encoded array of payment options:
transferWithAuthorization off-chain, and returns it as the PAYMENT-SIGNATURE header (base64-encoded).
Settlement flow
Settlement happens after your handler responds. The agent doesn’t wait for on-chain confirmation — Prudra handles that asynchronously. ThePAYMENT-RESPONSE header in the 200 response includes the txHash and a settlementPending flag.
When to use x402
| Scenario | Recommendation |
|---|---|
| Agents using Base wallet | x402 or dual-protocol |
| Agents using USDC on Base | x402 or dual-protocol |
| Maximum compatibility | Dual-protocol (both x402 and MPP) |
| Session payments needed | Use MPP instead |
| Simple, one-off payments | x402 |
Tokens and chains
x402 currently supports:| Token | Chain | Chain ID |
|---|---|---|
| USDC | Base | 8453 |
| USDC | Base Sepolia (testnet) | 84532 |
Related
- How x402 works — ERC-3009 flow in depth
- Add x402 to an endpoint — configure payMiddleware for x402
- Test x402 payments — test without real funds
- Handle the payment response — read the PAYMENT-RESPONSE header
- Dual-protocol payments — use x402 and MPP together

