- Home
- Skills
- APIs & Backend
- x402 Paywall on Base: get paid per API call
Works with the AI Agents you already use
x402 Paywall on Base: get paid per API call
Add a USDC paywall to any API on Base with x402 - and skip the six traps that cost us hours.
$15
x402 Paywall on Base: get paid per API call
Example session with this skill installed
I have a small HTTP API and I want to charge 2 cents per call in USDC on Base with x402.
Set it up and warn me about the traps before I waste hours.
- Read your context and instructions
- Compiled the x402 paywall on
Summary
A working x402 v2 paywall on Base: unauthenticated callers get a 402 with the payment
requirements, paid callers get their data. Cost: zero platform fees beyond the network, and
you keep the whole 2 cents.
| Check | Before | After |
|---|---|---|
| Unpaid call | 200 (everyone) | 402 with accepts[] |
| Paid call | n/a | 200 + data |
| Price defined in | nowhere | 1 config file, read by the router |
| Price actually charged | - | verified: 20 000 atomic USDC = $0.02 |
The traps, in the order they bite
- Self-payment is refused. The facilitator rejects a payment where
from == towith
self_send_not_allowed. If your test call returns 502, your service is fine - your test
wallet is trying to pay itself. Use a separate funded wallet for tests. - The price lives in four places: the route table, the config file, the pricing function
and the status report. Forget one and the route is silently free - it still answers 200,
which is exactly why nobody notices. - v2 wants
resourceas an object (ResourceInfo), not a string. Send a string and the
facilitator answers "paymentPayload is invalid" without saying which field is wrong. - The 402 must carry the discovery extension with a schema that validates against its own
infoblock, or the public catalog will not index you. - EIP-3009: sign
TransferWithAuthorizationwith the USDC domain (name: "USD Coin",
version: "2", chainId 8453), avalidAfter/validBeforewindow and a random 32-byte
nonce. Get the domain wrong and the signature simply never validates. - Confirm the settlement. Poll the transaction receipt; a 200 from your own router is not
proof that USDC moved.
Verification checklist (run all five before selling)
curlthe endpoint with no payment header → expect 402 and a readableaccepts[].- Read the price back from your own code (not from memory) → expect it in atomic USDC.
- Confirm
payTois the wallet you think it is. - Pay once with a separate funded wallet → expect 200 and the data.
- Check the receipt on-chain: status
1, right block, right amount.
Scope, honestly: x402 gives you per-call payment, not refunds, not subscriptions and no
chargeback protection. Prices below the network cost per call are not worth it, and the
catalog only lists you after a payment settles through the public facilitator.
Next steps
- Wire the price table to one source so a new route cannot be born free.
- Log every settled payment with its transaction hash from day one: that log is your sales
history, and it is the only proof you will have.
Connects securely to your tools. The creator never sees your data.
About this skill
Your API answers 200 for everyone. This skill turns it into a paid endpoint.
x402 is the payment standard that lets an agent pay per HTTP call in USDC - no accounts, no invoices, no subscriptions. This skill takes you from a plain endpoint to a working paywall on Base: the 402 response, the payment requirements, the facilitator that verifies and settles, and the verification checklist that proves it actually charges.
What makes it worth $15: the traps. We shipped this ourselves and paid for every one of them in hours:
- The facilitator that refuses a self-payment ("self_send_not_allowed") - and why your test payment fails with a 502 while your service is perfectly fine.
- The price table that lives in four places, not one: any route you forget serves free forever while looking healthy.
- The v2 payload where
resourcemust be an object, not a string (the error message does not tell you this). - The exact-response rule your schema has to satisfy for the discovery catalog to index you.
- The EIP-3009 signature details (domain, validity window, nonce) that make the difference between "invalid payment" and a settled transaction.
What you get: a step-by-step build, a five-point verification checklist (price, pay-to address, network, live 402, settled test transaction) and the honest scope of what x402 does not do (no refunds, no subscriptions, no chargeback protection).
Who it is for: anyone selling data, checks or computations to AI agents, and any developer who wants to charge for an API without a Stripe account.
Requires a separate payer wallet for testing. Does not cover infrastructure hosting or domain setup. Focuses on Base mainnet (EIP-155:8453) logic.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 2 months ago
Permissions
No special permissions declared or detected
What's inside
Frequently Asked Questions
New in APIs & Backend
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.