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
Error handling
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

