I run a small pay-per-call API on Base. For weeks it had zero paying callers. Hundreds of agents found it, read the docs, got the 402 challenge, and left. I know that because I counted: 2,399 requests in one day, 254 distinct IPs, 783 402 responses, 0 payment headers.
Then one payment landed. This is the receipt and the three real defects it exposed.
The receipt
- tx:
0xb80a1f7a5412f8e5fc21c0fe49ca2decf8db4d584f8fd9af621b40856a2189a5 - network: Base mainnet, status 0x1, block 0x3c7e05b
- asset: USDC
0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 - amount: 20000 atomic = $0.02
- payer -> payTo:
0xcb8cff7e...56c2c1->0x37239DF5...B38C57
I verified this directly on mainnet.base.org, not by trusting an email.
Defect 1: the payer paid and got a 400
The log is unambiguous:
14:35:25 payment confirmed on chain
14:35:26 POST /task -> 400 Bad Request
The code_explain task called ast.parse(text) on whatever arrived. The caller sent a normal sentence — explain print(sum(range(10))) — and got invalid syntax (line 1). Money taken, no service delivered. That is the fastest way to lose the only buyer you have.
Fix: accept both raw source and prose. Pull the Python expression out of the sentence, explain it, and if nothing parseable is found return a helpful structured response with a copy-paste example instead of a 400. I also put a concrete example in the 402 body and schema, because agents read the example, not your prose.
Defect 2: every route had the same description
One endpoint with a task query parameter meant all 28 catalog rows shared a single generic description. It listed summarize, sentiment, translation, code tools — but not web_search. The bazaar schema said {"task":"web_search"} while the description said something else. A consumer reading the 402 was told the endpoint did a different job.
Fix: per-task description and per-task example in the 402 resource, discovery documents and OpenAPI schema. This matters more than it sounds — an independent audit of 10,000 public catalog rows found 14.7% misdescribe their product.
Defect 3: the settle bypassed the facilitator
Our 402 declared the CDP facilitator. The first payer settled directly instead:
tx input selector: 0xe3ee160e
= keccak("transferWithAuthorization(address,address,uint256,uint256,uint256,bytes32,uint8,bytes32,bytes32)")[:4]
That is a direct EIP-3009 call to the USDC contract. There is no facilitator call in the transaction. The money arrived, but the CDP Bazaar merchant endpoint still reports total: 0 — because a row is written only when a payment settles through the facilitator. Declaring a facilitator in the challenge does not force the payer to use it.
Worth knowing before you wonder why your catalog row never appears.
The bug that cost the most time: EIP-3009 v normalization
When verifying the signed authorization by hand, EIP-3009 v arrives as 27/28 in some clients and 0/1 in others. If you feed 27/28 to a library expecting 0/1, recovery does not fail loudly as a bad signature — it recovers address(0) and you get "invalid signature" with no hint why. Normalize 27->0 and 28->1 before recovery. That single trap consumed more time than everything else here combined.
What actually moves the needle
I asked an operator who had been through this. His measured numbers: 457 distinct agents found his API over months, 17 addresses ever paid, 10 of them strangers, and zero in the last 30 days. His conclusion, which matches my own traffic: a young paid API consisting entirely of probes is normal. A probe costs nothing. A buyer needs a wallet and funds first.
What changed his numbers was never a listing. It was a third party paying a real call and saying so publicly. So here is mine, with the tx above.
If you run a paid API: fix the thing that charges and fails, make the 402 describe exactly what the route does, check how your payments actually settle, and publish the receipt when someone pays. Everything else is traffic.
Top comments (3)
Defect 3 is a great catch. It explains a lot of "I got paid but Bazaar still shows 0" confusion.
Your 783 402s vs 0 payment headers matches what I see on npm. Over the last 4 weeks the seller side kept climbing (
@x402/express55k to 73k/week) while the buyer client (@x402/fetch) went 230k, 259k, 285k, then back to 242k. Sellers grow steadily; paying clients wobble. npm counts include CI, so read it as direction, not users. Weekly numbers: penny24x7.github.io/x402-npm/Question: did that payer hit your endpoint with a payment header first and then settle on their own, or did the transfer show up with no paid request at all?
Defect 1 is the one I'd worry about most, and you fixed it the right way: take the money, return something useful. The harder case is a settle call that throws before you have a tx hash. You don't know if the buyer paid, so "failed" and "paid" are both wrong. We ended up with a third state, unknown, resolved later by reading the chain. What would your server do today if the facilitator timed out mid-settle?
Defect 1 is the one that should scare every seller: money taken, service refused, and the log says both steps succeeded. We test the mirror image — a resource served despite an invalid payment — and the rule is symmetric: if the payment moved and the service didn't, that's a FAIL with the payer's money as the evidence, not a 400 to debug later. Your fix is right, and the deeper lesson is the one you already found: the example in the 402 body is the contract agents actually read.
Defect 3 is the sleeper. "Declaring a facilitator does not force the payer to use it" means your listing truth and your settlement truth can diverge silently — Bazaar says total: 0 while the chain says paid. The reconcile has to run against the chain (a transfer to your payTo for at least the quoted price), never against the facilitator's dashboard. A seller that trusts the dashboard keeps the failures and loses the buyers who actually paid.
The v-normalization trap (27/28 vs 0/1 recovering address(0)) belongs in every x402 debugging checklist — it fails as "invalid signature," which sends you auditing keys instead of a two-line normalization.
Some comments may only be visible to logged-in visitors. Sign in to view all comments.