Skip to main content

Base URL

All examples use the dedicated x402 host:
Do not point x402 clients at data-tools.prd.arrays.org. That host is API-key auth and answers a bare GET with 401, so the SDK never sees the 402 challenge. (It does return 402 if you add Accept-Payment: x402, but stock SDKs don’t send that header.)

Prerequisites

  • An EVM wallet
  • Funds on one of the supported rails: USDC deposited via Circle Gateway (settles on Base), or USDC / USDT / USD1 in your wallet on BNB Chain
  • x402-fetch (Node) or x402-requests (Python) installed — any x402 v2 client works

Step 0 — See the 402 challenge (no wallet needed)

Pick one accepts entry, sign it, and retry with the PAYMENT-SIGNATURE header. The SDKs below do this for you.

TypeScript example

That’s it. The first call returns 402; wrapFetchWithPayment automatically signs, retries, and returns the data. The settlement result (tx, network, payer) is in the PAYMENT-RESPONSE header of the 200.

Python example

Cost math

How much will it actually cost?
At sustained high volume, a subscription plan usually becomes cheaper than per-call nanopayment. Mix both: subscription for steady workloads, Nanopayment for spikes.

Troubleshooting

Errors come back as 402 with the standard envelope; the facilitator’s message is forwarded in error.message.
You are calling data-tools.prd.arrays.org. Switch to x402-data-tools.prd.arrays.org, or add Accept-Payment: x402.
The route is not one of the 15 priced endpoints. See the list.
Base rail: deposit USDC into Circle Gateway. BNB Chain rail: fund the signing wallet with the chosen asset.
Nonce reuse. Generate a fresh 32-byte nonce for every call.
validBefore - validAfter must be at least maxTimeoutSeconds from the 402 (345600s on Base).
Signer must equal the token holder, and the EIP-712 domain must match the extra block of the accepts entry you chose (on Base that is the Gateway Wallet contract, not the USDC contract).
PAYMENT-SIGNATURE is not valid base64 or does not decode to an x402 v2 payload. Make sure x402Version is 2 — v1 clients fall back to the X-PAYMENT header, which is not accepted.