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.
Add x402 to an endpoint
payMiddleware accepts x402 by default as part of its dual-protocol behaviour. The standard configuration works with all x402-compatible agents without any additional options.
- Dashboard
- SDK
- cURL
Dashboard support for managing paid endpoints is coming soon. Use the SDK to configure x402 on your routes.
What the 402 response looks like
When a request arrives without payment,payMiddleware returns:
PAYMENT-REQUIRED header is the x402 challenge. An x402 agent decodes it, signs an ERC-3009 authorization, and resubmits with PAYMENT-SIGNATURE.
What the 200 response includes
After successful x402 payment:PAYMENT-RESPONSE header with settlement details — see Handle the payment response.
payMiddleware options
| Parameter | Type | Required | Description |
|---|---|---|---|
price | string | Yes | Payment amount in USD. e.g. "0.05" |
description | string | No | Human-readable description of the endpoint |
acceptSessions | boolean | No | Enable session payments (MPP only). Default: false |
Error handling
| Error | Status | Cause |
|---|---|---|
payment-verification-failed | 402 | Invalid signature or expired credential |
duplicate-payment | 409 | Same nonce used twice (replay attack blocked) |
challenge-rate-limit | 429 | More than 20 challenge requests/IP/60s |
Next steps
- Test x402 payments — test the full x402 flow with a real signing script
- Handle the payment response — decode the PAYMENT-RESPONSE header
- How x402 works — the ERC-3009 flow in depth

