x402 Payments for APIs: How to Charge AI Agents Per Request
x402 payments let an AI agent pay for a single API call over HTTP 402, with no account or API key. How the handshake works, real volume, and where it fits.

Most paid APIs ask an AI agent to do three human things before its first paid call: create an account, confirm an email, and enter a card. x402 payments remove all three. The server answers an unpaid request with HTTP 402 Payment Required and a price. The agent signs a stablecoin payment and sends the request again, and the payment itself is the credential. If you want to charge AI agents per request, this is the shortest path from “an agent found your API” to “an agent paid you” that exists in November 2026.
The market is small, and the transaction counts overstate it. Coinbase’s headline figure is 205 million transactions, while on-chain facilitator settlement in mid-November ran about half a million dollars a week. We think both facts point the same way. The protocol costs almost nothing to add, and the agents it serves are the ones that would otherwise stop at your signup form and leave.
What are x402 payments?
x402 payments are an open standard for paying over HTTP, named after the long-unused 402 status code. A server returns 402 with a price, the client retries with a signed payment, and the server returns the resource with a receipt. Payment settles in stablecoins, mostly USDC, and no account, API key, or subscription is needed.
Coinbase introduced the protocol in 2025. On April 2, 2026, the Linux Foundation launched the x402 Foundation and took over the protocol from Coinbase. Its named supporters include AWS, American Express, Cloudflare, Google, Mastercard, Microsoft, Shopify, Stripe, and Visa. The x402 project says the protocol is “free for the customer and the merchant—just pay nominal payment network fees,” supports all EVM-compatible chains and Solana, and needs “no accounts or personal information.”
At a glance
- Payment replaces signup. The agent pays for one request with a signed stablecoin payment. Your server never has to create, verify, or bill an account.
- The handshake uses three headers.
PAYMENT-REQUIREDon the 402,PAYMENT-SIGNATUREon the retry, andPAYMENT-RESPONSEon the success, per the x402 V2 docs. - Facilitators are optional and hold no funds. They verify and settle on your behalf. When we gave coding agents an open task to charge agents per request, every run chose x402. The x402 List tracks 41, and 19 were active in the week to November 16, 2026.
- The money is real but small. Artemis found that more than 95% of x402 activity is protocol signaling, as Forkast reported. Tracked facilitators settled about $502,600 in the seven days to November 16.
- Big platforms already support it. Stripe accepts x402 on Base in USDC, and Cloudflare’s Monetization Gateway charges for pages, APIs, and MCP tools over x402.
- Most failures come from the implementation. A May 2026 security paper found five attacks. The most common, replay, is an ordinary idempotency bug with money attached.
How does an x402 payment work, step by step?
An x402 payment takes two HTTP round trips. The first gets a price and the second carries the payment. Between them, the agent signs a payment with its wallet. On your side, the server checks the payment, does the work, settles, and returns the result with a receipt. A typical integration adds one piece of middleware in front of the paid route.
One paid request over x402No account, no API key: the payment authorizes the request
Figure 1. One paid request over x402. The agent never registers. The 402 response tells it what to pay, and the signed retry is both the payment and the authorization. Header names follow the x402 V2 specification.
Here is what each step carries:
- The unpaid request. The agent calls your endpoint the way it calls any API.
- The 402. Your server answers
402 Payment Requiredwith a base64-encodedPAYMENT-REQUIREDheader listing the accepted payment schemes, price, network, and destination address. - The signature. The agent’s wallet signs a payment payload for that price.
- The retry. The agent sends the same request again with the payload in
PAYMENT-SIGNATURE. - Verify, work, settle. In the x402 facilitator flow, your server sends the payload to the facilitator’s
/verifyendpoint. If it’s valid, the server does the work, then calls/settle. The facilitator “does not hold funds or act as a custodian,” and you can settle without one if you run your own chain infrastructure. - The response. Your server returns
200 OKwith the resource and aPAYMENT-RESPONSEheader holding the settlement result.
Timing depends on the payment scheme. The docs say the exact and upto schemes “typically settle immediately,” while batch-settlement confirms the authorization up front and redeems later. Batching suits high-frequency calls of a fraction of a cent.
Why does a payment replace the signup?
Payment works as authentication because a valid signed payment already proves what an account mostly exists to prove: the caller is accountable and you’ll be paid. For anonymous, metered work, nothing else is needed. Stripe’s machine payments documentation says it plainly: account creation, plan selection, and payment entry “require human input, which blocks agents from completing tasks autonomously.”
When Hi Violet runs agents through a product, the same column fails again and again. Agents find the docs, pick a plan, and then stop at “Create an account” because of an email code, a CAPTCHA, or a card form built for a person. Our readiness-score study walks through a run board where that column ends most runs. For any endpoint where the work doesn’t depend on who the caller is, x402 deletes the column.
Not every endpoint qualifies. If the request touches data a user owns, you need to know who that user is, which calls for a gated free signup that agents can complete, or for a temporary, expiring link to one private resource. The three tools fit together: x402 for paid anonymous work, gated signup for owned accounts, and temporary links for evaluations.
How much real money moves over x402 today?
Not much yet, and less than the headline counts suggest. The figures below come from different counters using different methods, so read each one on its own terms. Transaction counts run into the hundreds of millions because tests, bots, and token experiments all generate payments. Measured commercial volume in late 2026 is in the tens of thousands of dollars a day.
| Metric | Value | Source | Date |
|---|---|---|---|
| Cumulative x402 transactions on Base | Well over 100 million, through Q1 2026 | Chainalysis | June 3, 2026 |
| Share of volume in transactions of $1 or more | 95%, up from 49% in early 2025 | Chainalysis | June 3, 2026 |
| Cumulative transactions and volume | 205 million transactions, $53 million | Coinbase data, via Cryptonews | August 27, 2026 |
| Share of activity that is protocol signaling | More than 95% | Artemis, via Forkast | August 4, 2026 |
| Real daily commercial volume | About $28,000 | CoinDesk, March 2026, via Forkast | August 4, 2026 |
| Facilitators listed, and active in the last 7 days | 41 listed, 19 active | x402 List | November 16, 2026 |
| Settled by tracked facilitators, last 7 days | About $502,600 | x402 List | November 16, 2026 |
Coinbase’s cumulative figures work out to about 26 cents per transaction. The x402 List’s on-chain count for the week to November 16 comes to roughly $72,000 a day. Those two numbers say more about the market than the 205 million count does. Our growth signal stack describes the same trap: the easiest number to collect quietly becomes the strategy. For x402, the number that matters is dollars settled for work delivered, not payments counted.
Why build for a market this size? Entry costs a middleware layer and a wallet address, the rails already sit inside Stripe and Cloudflare, and the payers who arrive are agents with no other way to pay you. Measure whether runs that used to stop at signup now finish with a receipt.
Where do x402 payments fit, and where don’t they?
x402 fits per-request work that doesn’t need to know who the caller is: data lookups, single tool calls, gated content, overage beyond a free tier, and one-off purchases. It fits poorly when work touches a user’s own records, when the buyer needs invoices and contracts, or when the buyer pays only by card. Match the rail to the endpoint, not to the whole product.
| Use case | Why x402 fits | Typical price shape |
|---|---|---|
| Data endpoints (prices, records, enrichment) | Each call is self-contained and the caller’s identity doesn’t change the answer | Fixed price per call |
| Per-call tools, including MCP tools | Agents discover a tool and want to use it once, not subscribe | Fixed price per tool call; Cloudflare’s example is $0.01 per request |
| Premium docs, datasets, and reports | The agent needs one document now, not a seat | Per document or per download |
| Overage beyond a free tier | Keeps a free-plan agent working past the cap without an upgrade flow | Metered, often with upto or batch settlement |
| One-off purchases by agents | A render, an inference, or a report bought for a task, with no relationship needed | Per job |
| User-owned data (accounts, files, settings) | Poor fit: you need the user’s identity | Use a gated signup |
| Enterprise contracts and invoicing | Poor fit: procurement wants terms, not per-call receipts | Keep the sales path |
What are the security risks of x402, and how do you guard against them?
The main risks sit in the implementation, not the protocol. Researchers from Ohio State, CSIRO, and the University of Manchester published Five Attacks on x402 on May 12, 2026, after more than 25,000 payment requests across 48 configurations on Base Sepolia and local test chains. Each attack has a matching guard you can build on day one.
| Attack | What goes wrong | Guard |
|---|---|---|
| Revert-grant under optimistic execution | The server delivers before the payment is final, and the payment later fails | For valuable responses, release only after the payment is reserved or final |
| Unauthorized settlement preemption | Someone else uses the payment authorization before your facilitator settles it | Accept settlement only from the facilitator you endorsed |
| Replay and idempotency | One payment is resent through retries or concurrent requests and buys many responses | Claim each payment once, keyed to its identity and the resource, before granting |
| HTTP and proxy confusion | A proxy or CDN corrupts payment headers or caches a paid response for the next caller | Mark paid responses no-store and keep payment headers out of shared caches |
| Server-selection attacks | Faked discovery metadata steers agents toward a hostile endpoint | Validate listing metadata and limit duplicate registrations |
The replay case deserves the most attention because it starts with ordinary engineering. SDK retries, load-balancer retries, and parallel workers can all send the same payment twice. If your idempotency record lives on one worker instead of in a shared store, you’ll grant a second response for one payment. When Hi Violet tests an x402 endpoint, the run set includes retries and concurrent duplicates for exactly this reason.
Which x402 setup do coding agents pick on their own?
x402, every time, with the facilitator that asks the seller for the least. In the Hi Violet AX Panel 2026 we gave Claude Code and OpenAI Codex an open build task that never names a vendor: a minimal Node.js and TypeScript API that “charges AI agents per API request without requiring them to create an account.” Each agent ran it three times, from an empty folder.
| Run | Rail chosen | Facilitator | Alternative it rejected, and why |
|---|---|---|---|
| Claude Code, runs 1 to 3 | x402 | Coinbase Developer Platform on mainnet, the public x402.org facilitator on testnet | Stripe machine payments: needs a Stripe merchant account first |
| Codex, runs 1 to 3 | x402 | PayAI | Stripe machine payments: needs merchant onboarding first. Runs 1 and 3 also passed on Coinbase’s facilitator: needs merchant API credentials |
Figure 2. Six tool-choice runs from the Hi Violet AX Panel 2026, November 16, 2026. All six built an Express server that answers an unpaid request with a 402 and a USDC price on Base.
The reasons line up with the protocol’s pitch. One Claude Code run described x402 as needing “only a wallet: no signup, no API key, no card” on the buyer side, and accepted a Coinbase API key on the seller side for mainnet settlement. Codex went one step further and picked PayAI because it lets a seller start without signing up for the facilitator at all. Neither agent picked on price. Both picked the path with the fewest accounts between the code and the first paid request.
The payments companies in the same panel have done the agent tooling and left the account in front of it. Nine of 10 publish an MCP server, nine publish an llms.txt file and five ship a CLI, by their own pages. Those servers operate inside an existing merchant account: Checkout.com’s, for one, needs an active Dashboard account. An agent can read every tool and still has to hand the signup back to a person. The full breakdown of how agents choose tools covers the other 29 products.
x402 vs Stripe MPP and KYAPay: which should you accept?
Accept x402 when your buyers are agents with stablecoin wallets and you want the most open standard. Add Stripe’s Machine Payments Protocol when buyers pay by card. Look at Skyfire’s KYAPay when you need the agent’s verified identity alongside the payment. Many products will run more than one. Our full comparison of agent payment protocols covers each rail in depth.
- Stripe MPP. Stripe and Tempo released MPP on March 18, 2026. Stripe’s docs say machine payments “works best” with MPP, which accepts cards through Shared Payment Tokens and stablecoins on Tempo and Solana. Stripe also supports x402 on Base in USDC, and both settle to your Stripe balance in fiat. If you already bill through Stripe, you don’t have to choose between them.
- Skyfire KYAPay. The KYAPay profile is an IETF Internet-Draft dated March 31, 2026. It defines signed JWTs that carry the agent’s identity, its human principal, and a payment. It fits sellers who must know who is behind an agent before they serve it.
- PIVX Agent Kit. This is a separate rail: a wallet and MCP server that let agents pay with shielded, private transactions. It doesn’t run over x402. The two can sit side by side, x402 for open stablecoin metering and PIVX where transaction privacy matters, with overlap where a buyer could use either. Hi Violet is affiliated with PIVX Labs.
How do you add x402 payments to an API without breaking agent runs?
Choose the endpoints where runs stop at signup but the work needs no identity. Price them in the 402, settle through a facilitator, and guard against replay. Then run the same agent tasks again and count how many now finish. The middleware is the easy part; proving agents can find the price, pay, and get the result is the work.
- Pick endpoints from evidence. Start with the steps where agent runs end, not with the endpoints you’d like to monetize.
- Publish the price twice. Put it in the 402 and in your docs and markdown pages, so an agent can plan a budget before it calls. Agents that hit an unexplained 402 tend to give up or ask their user.
- Choose settlement. Use a public facilitator, Cloudflare’s Monetization Gateway if Cloudflare already sits in front of your API, or Stripe’s x402 support if you want fiat in your Stripe balance.
- Build the guards first. Add a shared idempotency store,
no-storeon paid responses, and a fixed facilitator. - Write the 402 for a machine. Return a body that names the price, the networks, and a link to docs. Keep the copy as clear as your best error message.
- Re-run the tasks. Fund test wallets on a testnet and run the same agents again to compare runs that clear with runs that stop.
Web3 teams start ahead because their users already hold wallets. Their harder job is the connected-path problem from our consumer-crypto surface map: the payment step has to join docs, discovery, and support.
How Hi Violet tests and ships x402
Hi Violet treats x402 as one lever in agent experience work, and we only call it a fix once a re-run proves it. We build sandboxed copies of your docs, signup, and API (the RL environments described in our method). Then we run a fixed task set many times across a fixed roster of coding agents, browser agents, and assistants. Every step of every run is marked Cleared, Asked, or Stopped.
When runs stop at signup on endpoints that don’t need identity, we add x402 with funded test wallets, the replay and caching guards above, and a 402 written for agents. Then we run the same tasks again. Where an endpoint does need identity, we use the other levers: gated free signups agents can complete, temporary qURL access for evaluations, and PIVX Agent Kit payments where privacy matters. If you want to see where agents stop in your product today, request access and we’ll scope the AX audit in writing.
Frequently asked questions
What is x402 in simple terms?
x402 is an open protocol for paying over HTTP. A server answers an unpaid request with status 402 and a price. The client signs a stablecoin payment and sends the request again, and the server returns the resource with a receipt. No account or API key is involved, and the Linux Foundation has governed the protocol since April 2026.
Do AI agents need an account to pay with x402?
No. The signed payment authorizes the request. The x402 project says it needs no accounts or personal information and no API key management. The agent needs a funded wallet. Your server needs a wallet address and, in most setups, a facilitator to verify and settle payments.
What does an x402 facilitator do?
A facilitator verifies the client’s payment payload and settles it onchain for the server. It’s optional but recommended, and it doesn’t hold funds. In the documented flow, your server calls /verify, does the work, calls /settle, and then returns the response with the settlement result.
How much does it cost to accept x402 payments?
The protocol itself charges no fee. x402.org says the customer and merchant pay only nominal network fees. Facilitators and platforms built on top set their own terms. Stripe, for example, settles x402 payments to your balance in fiat and sets a minimum stablecoin charge of 0.01 USDC.
How much real money moves over x402?
Less than the transaction counts suggest. Coinbase reported 205 million transactions and $53 million in cumulative volume in August 2026. Artemis found that more than 95% of activity was protocol signaling. On-chain settlement by tracked facilitators came to about $502,600 in the week to November 16, 2026.
Can I accept x402 payments through Stripe?
Yes. Stripe’s machine payments supports stablecoin payments over x402 on Base in USDC, and they settle to your Stripe balance. Stripe also runs its own Machine Payments Protocol, which adds card payments through Shared Payment Tokens and stablecoins on Tempo and Solana.
Do coding agents choose x402 on their own?
Yes. In the Hi Violet AX Panel 2026, Claude Code and OpenAI Codex were each asked three times to build an API that charges AI agents per request without accounts. All six runs chose x402. Claude Code settled through Coinbase’s facilitator, Codex through PayAI, and every run passed on Stripe machine payments because it needs a merchant account first.
Is x402 secure?
The protocol is sound, but implementations fail in predictable ways. A May 2026 paper showed five attacks, including one payment replayed through retries to buy many responses. Claim each payment once before granting access, never cache paid responses, and accept settlement only from the facilitator you chose.


