Client Setup
ELUUP’s x402 endpoints require every paid request to carry a signed USDC payment authorization. You do not construct this by hand — the@x402/axios client library wraps your existing axios instance and handles the full challenge → sign → retry flow automatically.
Install dependencies
Configure the client
api will:
- Send the request without payment.
- If the server responds
402, read the payment requirements, sign a USDC authorization withsigner, and automatically retry the request with the signed payment attached. - Return the final response — whether that’s a
200success, or a402if the retried payment also failed (see HTTP 402 — Payment Required for why this does not throw).
Important: never use the payTo wallet as your payer
The payTo address is ELUUP’s payment-receiving wallet. Your signer must be a different wallet than payTo, funded with your own USDC. Attempting to pay from the same address as payTo is rejected with self_send_not_allowed (see HTTP 402 — Payment Required).
Fund your wallet correctly
Before making any paid request, confirm:x402 docs: Overview · Quickstart · Payment Flow · API Reference · Errors & Troubleshooting · Examples