x402 Payments — How AI Agents Pay for Scraping
AI agents increasingly need to fetch web data: prices, listings,
articles, compliance records. But agents can't fill out signup forms or
click "confirm email". x402 solves this by making the HTTP status
code 402 Payment Required machine-payable: the API asks for crypto,
the agent pays from a wallet, and the call proceeds. No account, no API
key — in the x402 lane, the payment is the credential.
The x402 protocol in one flow
x402 (revived by Coinbase's x402 spec) works like this:
- The agent calls a paid endpoint with no payment.
- The server responds
402 Payment Requiredwith aPAYMENT-REQUIREDheader — a Base64-encoded JSON body containing the receiving wallet, amount, asset, and facilitator. - The agent signs and broadcasts a payment (typically USDC) to that wallet.
- The agent submits the transaction to the server, which verifies it on-chain and returns an access token.
- The agent replays the token (
X-Payment-Idheader) until it expires.
curl https://api.pryscraper.com/v1/x402/pricing
# {"scrape": {"price_usd": 0.001}, "crawl": {"price_usd": 0.01}, ...}
Prices are per operation and published at /v1/x402/pricing, so an
agent can budget before it spends: one page costs a tenth of a cent, a
thousand-page bulk crawl costs ten cents.
EIP-3009: the settlement primitive
On EVM chains, Pry verifies payments via EIP-3009
(transferWithAuthorization) — the USDC standard for gasless,
signature-based transfers. The payer signs an authorization; the
facilitator (or the server itself, via EIP-7702 self-verify) submits it
on-chain. Permit2 and plain native transfers are also supported, so
USDT, ARB, ETH, and WETH work alongside USDC.
Verification is real: the transaction is confirmed on-chain before an
access token is issued, with a configurable TTL
(PRY_X402_PAYMENT_TTL, default 3600s).
Multi-chain treasuries: EVM, Solana, Tron
A Solana address can't receive an EVM transfer, so Pry keys receiving wallets by CAIP-2 network id — one treasury per chain family:
PRY_X402_ENABLED=true
PRY_X402_WALLET_BASE=0x... # EVM treasury (shared across EVM chains)
PRY_X402_WALLET_SOLANA=... # distinct base58 address
PRY_X402_WALLET_TRON=... # distinct T-prefix address
Pry accepts payments across seven chains: Base, Ethereum, Arbitrum, Optimism, and Polygon (EVM, USDC/USDT and native assets), Solana (SPL: SOL/USDC/USDT), and TRON (TRC-20: USDT/TRX). EVM settlement is turnkey; Solana runs through an SPL/facilitator verifier; TRON is scaffolded for operators who enable it explicitly.
How agents auto-pay via MCP
The friction point for agents is implementing the payment flow. Pry exposes 76 MCP tools, so an agent with an MCP client and a funded wallet can scrape without any bespoke payment code: the tool call returns the 402 challenge, the agent's wallet layer signs the EIP-3009 authorization, and the retry carries the payment. From the agent's perspective it's just another tool call that costs fractions of a cent.
This is the model we expect to win for machine-to-machine APIs: no onboarding funnel, no API-key provisioning, no minimum commitments — just a signed payment per call, settled on-chain.
Try it
- x402 pay-per-call guide — headers, endpoints, network table
- Pricing & monetization — the three lanes
- Source: Codeberg
Commercial licensing and hosted plans: [email protected].
