One gate.
Both sides, documented.

How an AI agent pays a per-page toll over x402, and how a site owner puts the gate in front of a site. No secrets here — the 402 below was fetched from the live gate, and the same terms are quoted to every agent that knocks.

I'm building an agent → pay a toll I own a site → install the gate

For AI agents: how to pay an x402 toll.

A gated page answers your first request with HTTP 402 Payment Required and machine-readable terms. Your x402 client reads them, signs a USDC payment from your wallet, and retries in the same motion. No account, no API key, no invoice — the receipt is the on-chain transaction.

// npm i viem @x402/core @x402/evm @x402/fetch
import { privateKeyToAccount } from "viem/accounts";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { wrapFetchWithPayment } from "@x402/fetch";

const account = privateKeyToAccount(process.env.AGENT_PRIVATE_KEY);
const client = new x402Client().register("eip155:*", new ExactEvmScheme(account));
const fetchWithPay = wrapFetchWithPayment(fetch, client);

const res = await fetchWithPay("https://edge.agent-toll.com/report");
// first attempt: HTTP 402 with the toll terms; the SDK signs and retries
console.log(res.status);        // 200, toll paid
console.log(await res.text());  // the page the toll was paid for

The wallet needs USDC on Base. Any x402-compatible client works the same way — the SDK above is one implementation, not a requirement. A runnable version of this example lives at github.com/johnlegoat/agent-toll-examples. No code at all? Tell your agent: fetch https://edge.agent-toll.com/report and pay any x402 toll it quotes. The demo toll is a real $0.02 on Base mainnet; the page behind it is a sample report.

The 402 response, annotated.

This is what the live demo gate actually answers — fetched with plain curl, decoded, and trimmed of its x402 discovery extension. The terms ride base64-encoded in the payment-required header and mirrored in the JSON body. One response quotes both rails; the agent picks its chain.

$ curl -i https://edge.agent-toll.com/report

HTTP/2 402 Payment Required
content-type: application/json; charset=utf-8
payment-required: eyJ4NDAyVmVyc2lvbiI6Mi…   ← base64 of the terms below

{
  "x402Version": 2,
  "resource": {
    "url": "https://edge.agent-toll.com/report",
    "description": "Agent Tolls protected content",
    "mimeType": "text/html"
  },
  "accepts": [
    {
      "scheme": "exact",
      "network": "eip155:8453",     // Base mainnet
      "amount": "20000",            // $0.02 — USDC carries 6 decimals
      "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",  // native USDC on Base
      "payTo": "0xe12CcCFE0C7868fE1AB6964Ef2E34216D975b44d",  // this gate's destination
      "maxTimeoutSeconds": 300
    },
    {
      "scheme": "exact",
      "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",   // Solana mainnet
      "amount": "20000",
      "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // the USDC mint
      "payTo": "BEizfd1dFKmdfDenFT5rAfw7YFKFxEqPrkcFLvDiSWnp",
      "maxTimeoutSeconds": 300,
      "extra": { "feePayer": "CjNFTjvBhbJJd2B5ePPMHRLx1ELZpa8dwQgGL727eKww" }
    }
  ]
}

amount is quoted in the asset's atomic units. On Solana, extra.feePayer is the gate's facilitator: it pays the transaction fee, so a paying agent needs USDC and no SOL at all. A browser requesting the same URL never sees any of this — it just gets the page.

For site owners: install the gate.

The gate lives at the DNS level — no code on your site, no plugin, no SDK. Five steps, about fifteen minutes end to end, and your DNS stays yours: point it away and you're out, any time.

  1. 01

    Create your account

    Sign in at app.agent-toll.com with Google or GitHub. A non-custodial payout wallet is generated for you through Privy — we store only its address — or you bring your own address.

  2. 02

    Add your site and prove it's yours

    Add the hostname in the dashboard and set the _agent-tolls TXT record it gives you. Ownership is verified from DNS — nobody can put a gate on a domain they don't control.

  3. 03

    Point your DNS at the gate

    One click via Domain Connect where your registrar supports it, or add the records by hand: a CNAME for subdomains; an apex domain uses the record set the dashboard shows, since a CNAME cannot live at the apex.

  4. 04

    Set your prices

    A default per page — $0.02 to start — and per-path overrides: /premium/* at $0.10, the deep archive at $0.25. Changed from the dashboard, any time, effective immediately. The model is on the pricing page.

  5. 05

    Get paid automatically

    Tolls settle on-chain to your site's split contract as agents read. Payouts to your wallet fire automatically once your balance clears $1 — on both chains. You keep 85%; our 15% is taken inside the contract, and nothing is ever invoiced.

FAQ

Does paying the toll require a specific SDK?

No. Any x402-compatible client works: the gate answers with standard x402 v2 terms in the payment-required header, mirrored in the JSON body. The @x402 JavaScript SDK shown here is one implementation, not a requirement.

What does a page cost an agent?

Whatever the site owner set: $0.02 by default, more or less per path. The exact price for a given URL is always in the 402 response itself, in the asset's atomic units.

Which chains and assets are supported?

USDC on Base mainnet and USDC on Solana mainnet, both quoted in one 402 response. The agent settles on whichever chain it holds funds on. On Solana the gate's facilitator is the transaction fee payer, so a paying agent needs USDC and no SOL at all.

Do human readers ever see the gate?

No. The gate tells browsers and agents apart from request signals, so a human visitor simply gets the page — nothing to click, no captcha. The toll applies only to machine visitors.

What happens to an agent that won't pay?

It never gets the page. The gate is protection either way: paid access or no access, at the owner's choice of price.

Can I try it without writing code?

Yes. Tell an agent that carries an x402-enabled wallet: fetch https://edge.agent-toll.com/report and pay any x402 toll it quotes. The demo toll is a real $0.02 on Base mainnet. Open the same URL in a browser and the page is free — the gate is invisible to humans.

Put a gate on your own site.

Free to install, no subscription, 85% of every toll straight to your wallet.

Start now See pricing