x402 overview
Understand Aly's configured x402 rollout path for selling digital products to agents with a simple HTTP payment challenge.
HTTP-native micro-payments for digital goods when enabled — 402 challenge + EIP-712 transfer authorization.
x402 is HTTP-native micropayments — the server answers a normal GET with 402 Payment Required, the client (agent or wallet) settles on-chain, and the same request replays with a proof header to receive the goods. No redirect, no hosted checkout, no human in the loop.
Aly's x402 surface is designed for digital products under a per-site price ceiling. When it is enabled for a deployment, buyers pay with USDC or another accepted stablecoin and the merchant receives funds at their configured wallet address.
At a glance
| Endpoint | GET /api/x402/product/{siteSlug}/{productId}?quantity=N&email=X@Y.Z |
| Eligibility | Digital product, USD price, ≤ site limit, file attached. |
| Networks | Deployment-configured EVM rails; planned defaults are Base, Ethereum, Polygon. |
| Scheme | EVM exact — transferFrom of the stablecoin amount. |
| Tx settlement | After response, x402 framework adds PAYMENT-RESPONSE header with tx hash. |
Flow at a glance
- Client issues
GETwith noPaymentheader. - Server checks eligibility, returns
402withaccepts(price, network, payTo) andnonce. - Client constructs an EIP-712 payment authorization, signs it, and replays with
Payment+Payment-Signatureheaders. - Server verifies the payment with the x402 facilitator, runs the handler — which creates the Order in Convex with an idempotency key derived from the payment payload — and returns 200.
- Settlement happens after the response. The framework adds a
PAYMENT-RESPONSEheader carrying the transaction hash.
Smallest possible exchange
# Step 1: see the pricecurl -i "https://aly.store/api/x402/product/acme/prod_pattern?quantity=1&email=buyer@example.com" HTTP/1.1 402 Payment RequiredContent-Type: application/json { "x402Version": 1, "accepts": [ { "scheme": "exact", "network": "base", "asset": "USDC", "maxAmountRequired": "5000000", "payTo": "0xabc...123", "resource": "/api/x402/product/acme/prod_pattern", "description": "Knitting Pattern PDF", "mimeType": "application/pdf", "extra": { "nonce": "..." } } ], "error": "X-PAYMENT_required"} # Step 2: pay (client constructs Payment, replays)# Step 3: server returns 200 with the order + download URLConfiguration
When x402 is enabled, per-site flags govern product eligibility:
site.cryptoPaymentsEnabled— master switch.site.cryptoWalletAddress— the merchant's receiving address (per network).site.cryptoPreferredChain— which chain to list first inaccepts.site.cryptoAcceptedTokens— token allowlist; USDC by default.
Next steps
- The 402 challenge flow — exact request/response shapes.
- Configured chains + wallets — supported rails when x402 is enabled.
- Verifying on-chain proofs — confirm settlement on your side.
Was this page helpful?