The people reading a blog are no longer just people. In 2026 the quiet majority of traffic to a technical site is machine traffic: RAG pipelines, research agents, knowledge-graph crawlers, fine-tuning scrapers. They read your content, extract your markdown, and contribute nothing to your ad impressions. So this site decided to do what every trader learns early — if you cannot stop the front-running, sell the order flow.
GET /api/content/{slug} on graphwiz.ai now serves any article as clean JSON, with metadata and the full markdown body — for $0.01, paid by an AI agent in USDC, on the request itself. No checkout, no signup, no wallet UX, no billing system of our own. That is the entire pitch of x402: HTTP 402 becomes a payment channel so small that a per-request price is viable.
This is a field report from actually wiring it up: the protocol, the five files it took, the two-hour gotcha I hit with test tooling, and what I would do differently next time.
graphwiz.ai runs on the usual stack of content sites: static pages, CarbonAds, AdSense, Plausible. That monetises humans. An AI agent does not render a <div class="ad-container">, and it does not emit a pageview worth of cookies — it fetches the HTML, or worse, the RSS feed, and quietly trains or retrieves. The readers who value the content most are exactly the ones the ad model cannot see.
The standard answer is a subscription, but that is also wrong for this traffic. No agent is going through a Stripe checkout, and no human is going to install a wallet for a single 1-cent article. So the monetisation splits cleanly by audience: humans stay on the free, ad-supported site; machines pay per payload at the edge. The RSS feed stays free too — it is a discovery channel, and paywalling it would be self-sabotage. The toll sits on the machine-readable endpoint that only agents have any reason to call.
x402 is a cross-network payment protocol built around the HTTP 402 Payment Required status. The flow is deliberately boring, which is the compliment:
402 with a PAYMENT-REQUIRED header — base64 JSON describing what it accepts: scheme, network, asset, price, and the seller's payTo address.PAYMENT-SIGNATURE header.PAYMENT-RESPONSE header containing the transaction.Two properties make the economics work. First, x402 is gasless for the seller by default: the facilitator sponsors or batches the settlement transaction, so our payTo address can be an empty wallet that never holds ETH to pay for gas. Second, the buyer signs once via EIP-3009/Permit2 — spending approvals are wrapped into the payment so there is no separate approve step and no token approval sitting around.
We standardised on the exact scheme on Base (eip155:8453, USDC). Base plus Solana cover roughly 85% of real x402 traffic, and across networks USDC is ~99% of settled value. If a Solana-paying agent shows up later, adding a second accepts entry is a config change, not a code change.
The site is Next.js 16 with an App Router API route. The x402 reference SDK ships a wrapper purpose-built for exactly this:
// app/api/content/[slug]/route.ts — the whole integration, disabled by default
const server = createContentResourceServer(); // x402ResourceServer + ExactEvmScheme
const config = getX402Config();
export const GET = server
? withX402(
handler, // existing business logic, untouched
{ accepts: [{ scheme: "exact", price: config.price, network: config.network, payTo: config.payTo }] },
server,
)
: handler;
The handler is the same code that serves the article; x402 wraps it. Two details are worth stealing:
Feature-flag by env, not by build. If X402_PAY_TO_EVM_ADDRESS is unset, the route exports the bare handler and the site behaves exactly as before. Deploy with the flag off, watch the metrics, then turn it on. Rollback is unsetting one environment variable — no code revert, no broken deploys.
The contract tests never touch a chain. The payment handshake is tested end-to-end against the real withX402 wrapper and the real resource server, but with a fake facilitator (a class that returns canned getSupported/verify/settle responses). That pins the entire wire contract — 402 + PAYMENT-REQUIRED on unpaid, 200 + settlement on verified, no settlement on invalid — without a testnet, an RPC, or a single private key in CI.
The gotcha that cost me the most time was not the protocol: withX402 calls the facilitator's getSupported() at module import time, before Vitest's top-level constants are initialised, so the mock factory briefly died on a TDZ error. The fix is to keep every value the hoisted mock touches as a literal. Add that to the list of "things that look like framework bugs but are your test setup."
The only variable cost is the facilitator. Our default in dev is the community facilitator at x402.org (testnet-only — fine for a pilot, useless for revenue). For mainnet there are two serious options:
| Facilitator | Cost | Notes |
|---|---|---|
| Coinbase CDP | 1,000 tx/month free, then $0.001/tx | KYT compliance screening built in; has processed 100M+ x402 payments; settles into Coinbase Business |
| PayAI | 0% published fee | Multi-network, self-custody settlement |
At a $0.01 price and CDP's fees, the coin flip is not "is the fee eating me" — it is "did anyone pay at all?" The honest forecast for a site our size is cents-to-low-dollars per day in the first months. Which is fine: the point of this feature is not the revenue, it is the position. It is a publicly testable, standards-based answer to the question every content business will be asked this year: how do agents pay you for what they take? And an AI agent that pays you is a lead — a warm, addressable, high-intent one.
paymentPayload.resource set auto-catalogs the endpoint into coinbase's discovery catalog (plus an MCP search server). That is the closest thing the agentic web has to organic placement, and it costs nothing beyond settling through CDP.curl -i https://graphwiz.ai/api/content/x402-agent-payments-machine-article-api
# 402 Payment Required
# PAYMENT-REQUIRED: eyJ4NDAyVmVyc2lvbjoyLC…
Point an x402-enabled client at that and it will price itself. That is the part of this that still feels like the future: a website asked a machine for money, and the machine just paid it — no account, no fraud review, no month-long contract. The web inventing a payment rail for its own automated readers, implemented in the time it takes to deploy a route, is a quietly big deal.