Build1 publisher3 min readPublished
The published client retries a 402 by signing a USDC transfer on Base and stuffing the transaction hash into a header. It works inside an ordinary httpx call, and it blocks for about three seconds before the retry goes out.
The Engineer · Build desk

Compiled by The EngineerSomething wrong?How this is made
Look at the retry loop, not the pitch. The client issues a plain GET. If the status is anything other than 402 it returns immediately [2]. On a 402 it parses `X-Payments-Required`, which in the worked example carries a JSON object with amount, currency, recipient and chain [4]. It then signs an ERC-20 `transfer` against the canonical USDC contract on Base, waits for the receipt, and fails loudly if the receipt status is not 1 [5]. The transaction hash goes into `X-Payment` as a JSON blob, the loop sleeps one second so the server can index the transaction, and the same GET runs again [6][7]. Three attempts, then a RuntimeError [3].
That is the whole mechanism. Two headers, one status code, otherwise vanilla HTTP/1.1 or HTTP/2 [1]. The compatibility argument is real: nothing here needs a new transport, a new client library, or a handshake. An agent that can already retry a 401 can be taught to retry a 402.
The cost of adoption sits in the parts the convention does not specify. The example sends payment before it has the resource, so atomicity is a property of the server's behaviour, not of the flow [8]. If the server takes the money and returns 500, the loop pays again on the next attempt. Nothing in the snippet caches a receipt against a URL. Nothing bounds spend. The amount is read from a header the server controls, cast to a float, and handed to the signer without a ceiling check [4][5]. A per-vendor API key at least has the decency to be a fixed liability.
Then there is latency. The helper waits for the transaction receipt with a 30-second timeout, and the author's comment puts two blocks on Base at roughly two seconds [9][5]. Add the deliberate one-second back-off [7]. So a first call to a paid endpoint carries something on the order of three seconds of settlement before the retry even leaves the client: two seconds of inclusion plus the one-second sleep, on the source's own numbers [10]. For a batch job, fine. For an inner loop at the quoted $0.005 per LLM token [11], the settlement is more expensive than the work.
That is the transfer question for anyone reading this as a replacement for invoicing. The stated design goals are atomicity, statelessness and reuse of the existing HTTP client stack [8]. Reuse holds on the evidence in front of us. Statelessness holds, in the narrow sense that no secret is provisioned per vendor. Atomicity does not follow from the code shown, and the per-call economics only work if the price per call is large relative to a few seconds of blocking. What would have to be true for it to fit a hot path: settlement moves off the critical path, or the server accepts a signed authorisation it can settle later. Neither appears in this source.
One structural note in the convention's favour. Because the price arrives in a response header rather than a contract negotiated in advance, a server can quote per call, and a client can decide per call. That is a genuinely useful property for machine callers, and it is not something an API key plus a monthly invoice can express [12].
Worth being precise about what this material is. It is a single explainer with a self-contained Python snippet, using httpx, web3 and eth_account, against a hypothetical x402-protected translation service [13]. It documents a convention and a client. It does not show a server implementation, a verifier, or a deployment.
Ranked by verification strength, evidence, and original report placement.
In the published x402_get helper, the client performs a plain GET and returns the response immediately if the status code is not 402.
The x402_get helper defaults to max_retries=3 and raises RuntimeError('Exceeded max retries for x402 payment') if payment attempts are exhausted.
The article states the wanted properties for paid agent calls as atomicity (the agent either gets the resource and pays, or gets nothing), statelessness (no long-lived session or API-key management per vendor), and compatibility (the agent can reuse its existing HTTP client stack).
The pay_usdc helper builds and signs an ERC-20 transfer against USDC on Base at address 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913, sends it, waits for the receipt with a 30 second timeout, and raises RuntimeError if receipt.status is not 1.
A code comment in the source puts inclusion at 2 blocks on Base, approximately 2 seconds.
The article's example of a per-call cost is $0.005 per LLM token.
Follow any of these and your For You feed starts watching them — no settings page required.
Evidence-backed comparisons of source perspectives and observed adoption signals. Read the methodology
Which Builder, Operator, and Investor concerns the observed source mix emphasized—not a truth score.
Evidence, demonstrated adoption, hype gap, incentives, and confidence are assessed independently, each on its own current evidence. How these are measured.
Full client code, one author, no server
Because every line of the client is published, the description can be checked against it, and in three places the description loses. Outside support is thin: the post points to no specification, shows no server implementation, and stands as the only account of this pattern, and the target service is explicitly hypothetical, so the on-chain half of the flow has never run against anything shown here.
Hypothetical endpoint only
The example points at api.example.com and the post calls the translation service hypothetical. No deployment, live call or paying vendor appears anywhere in it, so there is nothing to score.
Guarantees ahead of the code
Atomicity heads the list of properties the pattern is supposed to deliver, and the code spends first: pay_usdc returns a hash, the same GET is reissued, and if that answer is an error the money has already moved with nothing in the snippet to claw it back. Add the header the two-header framing forgets and a three-second figure assembled partly from a sleep that never fires, and the account runs ahead of the implementation by a fair margin.
No sponsor, opinionated defaults
No product, affiliation or sponsorship is disclosed and the post sells nothing; the visible stake is a developer's byline on a community platform. Its defaults still choose for the reader, though: a single chain, a hard-coded stablecoin contract, and a default hosted RPC provider, none of it argued for.
Checkable but unreplicated
The mechanical facts hold up well, since the helper signature, contract address, receipt handling and retry ceiling are quoted from code sitting on the same page. Confidence stops in the middle because the parts a reader would actually build against, the wire format of the two headers and the real latency of a paid call, are exactly where the post and its snippet disagree, and no second source can break the tie.
build
All 575 listed x402 services split $516.96 over thirty days1 publisher
build
France's e-invoicing deadline is really a bill for supplier data nobody verified1 publisher
build
One x402 service minted a fresh settlement wallet every 16 minutes for ten days1 publisher
invest
The agent payment rail cleared 8.7 million transfers last week, and $367,9501 publisher
Publishers with included, body-backed reporting in this cluster.
1 article · September 7, 2026