402 Payment Required; the agent pays, retries with proof, and gets the real response.
Dashboard path: app.getsly.ai/dashboard/onboarding/wizard/api-monetization
Estimated time: ~10 minutes
Who this is for
- SaaS APIs — pay-per-query or per-operation billing
- AI / ML inference — per-prompt, per-image, per-generation
- Data providers — per-record, per-query
- Any endpoint where sign-up-free, machine-initiated payment is valuable
What you’ll have when done
- A receiving wallet collecting x402 payments (USDC, on low-fee network by default)
- A test-funded wallet for sandbox verification
- Your API endpoint registered with x402 pricing
- Price-per-request rules applied
- A confirmed end-to-end test payment
Steps
1. Create your receiving wallet (required, ~2 min)
Sly creates a dedicated wallet that will collect payments from API consumers. Wizard asks you:- Wallet name (e.g.
x402-receipts) - Network — Solana is recommended for lowest fees; Base if you prefer Ethereum L2
2. Fund your wallet (optional, ~3 min)
Add initial USDC so you can test flows that reverse (refunds, disputes). In sandbox this is free (faucet); in live it uses card / Apple Pay / Google Pay / bank. If you skip: the wallet starts at zero balance. You can fund anytime from the dashboard. API equivalent (sandbox faucet):3. Register your API endpoint (required, ~3 min)
Tell Sly which API endpoint accepts x402 payments. Wizard asks you:- Your API base URL (e.g.
https://api.yourcompany.com) - The specific path + method you’re protecting (
POST /v1/infer) - Name + description (for your dashboard)
4. Configure pricing (optional, ~2 min)
Set price per request. Common ranges:- $0.001 — simple lookups, cheap compute
- 0.10 — AI / ML inference, heavier operations
- $0.10+ — expensive compute, premium data
5. Test your integration (optional, ~3 min)
Sly simulates an agent making a paid API call using testnet funds, showing the full 402 → pay → retry → 200 flow. If you skip: you can test anytime from the dashboard → Endpoints → [endpoint] → Test.After the wizard
Share your gateway URL with API consumers. They call it like any HTTP endpoint — agents using the Sly SDK auto-handle the 402 → pay → retry cycle. See x402 client usage. Monitor revenue. Dashboard → Endpoints → [endpoint] shows total calls, unique payers, revenue by window, and top payers. Go live. When ready, flip to apk_live_* key and your gateway serves real x402 traffic on mainnet.
What to configure next
- Webhook events — subscribe to
x402.payment.completedto get notified per payment - Rate limits — in addition to x402 gating, apply call rate limits to prevent abuse
- x402 bridge — if you want to accept USDC but settle in fiat via Circle
Troubleshooting
Agents get 402 but payment doesn't go through
Agents get 402 but payment doesn't go through
Check the endpoint
status is active (dashboard → Endpoints). Check the target URL in the x402 registration resolves and returns the real response on direct call — the gateway proxies to your origin, it doesn’t replace it.Payments go through but my API doesn't see the request
Payments go through but my API doesn't see the request
The gateway only forwards to your origin after payment verification. Confirm your origin allows Sly’s IP range (docs → IP allowlist) and that it’s not rejecting requests with the payment proof header.
Some agents hit 402 loops
Some agents hit 402 loops
Usually means the agent’s wallet is underfunded. The Sly SDK handles this cleanly; raw-HTTP agents must implement the 402 dance themselves.
