Guide · Agent-ready commerce
How to Get Your Storefront Ready for AI Agents
AI can write production code and pass the bar exam, but it still struggles to buy a pair of shoes online. That is not a model problem. It is a website problem: the web was built for human eyeballs and click coordinates, and agents were never given a way to use it.
The fix is arriving in two halves. WebMCP, a proposed open standard from Google, lets a page expose structured tools that browser agents can call directly instead of scraping the DOM. And x402, the open payment protocol built on HTTP 402, lets agents pay for what they use — per call, in USDC, on the Base network. This guide is the practical checklist for wiring both into a storefront, based on what we run in production on the AgentPay Directory.
Why scraping fails as a commerce interface
A visual agent shops the way a person with poor eyesight and infinite patience would: screenshot the page, parse twelve thousand lines of DOM, guess which button does what, click, fail, retry. The loop is slow, expensive in tokens, and fails on modern single-page apps roughly a third of the time. A Tailwind class hash changing in a theme update is enough to break the whole flow.
Storefronts feel this as lost conversions that never show up in analytics, because the buyer gave up before the cart. The agent never had a clean way to ask your site what it sells.
Step 1 — Register structured tools with WebMCP
WebMCP lets your page tell the agent what it can do, in the agent's native language: typed tools with JSON schemas. Under the current experimental spec, the API lives on document.modelContext in Chrome (behind an origin trial), and registration is a few lines of vanilla JavaScript:
if (document.modelContext?.registerTool) {
document.modelContext.registerTool({
name: "search_products",
description: "Search the catalog and return matching products with prices and stock.",
inputSchema: {
type: "object",
properties: {
q: { type: "string", description: "Search term" },
category: { type: "string" }
},
required: ["q"]
},
annotations: { readOnlyHint: true },
async execute({ q, category }) {
const r = await fetch(`/api/search?q=${encodeURIComponent(q)}&category=${category ?? ""}`);
return r.json();
}
});
}
The agent queries the tool manifest, calls search_products with clean JSON, and your own JavaScript executes natively. No screenshots, no CSS selectors, nothing that breaks when your theme changes. Feature-detect and degrade to a no-op where the API is absent — it is progressive enhancement, exactly like <script> was in 1997.
directory_search, get_listing, and directory_stats through WebMCP — an in-browser agent can query the whole endpoint economy without touching the DOM. View source and copy the pattern.Step 2 — Put a price on every call with HTTP 402
Structured tools solve discovery. Payment is the other half. The x402 protocol makes the forgotten 402 Payment Required status code into a real handshake: the agent requests a resource, the server answers with machine-readable payment terms, the agent signs a USDC authorization on Base, retries, and the request executes once payment settles on-chain. No account creation, no API keys, no invoicing.
A compliant 402 response names three things — the price, the asset and network (USDC on Base), and the facilitator URL that verifies and settles the payment. The facilitator should appear at every level of the response, because buyers read it from whichever layer their client library looks at.
curl https://your-store.com/api/checkout -X POST
# HTTP 402
# { "x402": { "price": "0.05", "asset": "USDC", "network": "base",
# "facilitator": "https://x402-agent-pay.com/facilitator" } }
You do not have to build settlement machinery to do this correctly. Our facilitator verifies EIP-712 payment authorizations and settles on-chain in USDC, and the sandbox wizard generates a compliant gate from a form. The refusal codes are published and machine-readable — an honest 402 never wastes the buyer's money on malformed input.
Step 3 — Prove what you delivered
Payments are the easy half of agent commerce. The harder question: how does a buyer know the tool actually ran, with the input they paid for, and returned the output it claims? Self-reported state is not proof.
The answer we run in production is verifiable tool-execution escrow: payment releases only against a provider's cryptographic signature over the tool's actual I/O log — the request hash, response hash, and timestamps. Tamper the log after signing and the escrow refuses to release and refunds the buyer. Failure codes are named explicitly (SIGNATURE_MISMATCH, REQUEST_MISMATCH), so the dispute is a fact-check, not a he-said-she-said.
Step 4 — Be discoverable where agents shop
Agents do not window-shop. When one needs a capability, it searches a registry or asks its tools directory. Your storefront should be listed where those lookups happen, with honest, machine-checkable terms:
- One listing per endpoint, with its real price. The AgentPay Directory runs a price-honesty probe that re-crawls every listed endpoint every six hours and flags mismatches between the advertised price and what the 402 actually asks for. Honest listings rank; stale ones get flagged publicly.
- Machine-readable capability docs. An
openapi.jsonand MCP manifest so an agent can read your contract without rendering a page. - A live 402. Listings whose endpoints answer with payment terms get indexed as payable. Dead endpoints get delisted.
- Self-serve registration. Register an account, submit your endpoint, pass the liveness gate, and get listed — no negotiation, no sales call.
Step 5 — Budgets, trust, and receipts
Commercial buyers will not hand an agent a blank check. The pattern that unlocks enterprise spend: owner-signed spend authorities — budget caps, per-resource limits, and no-confirm thresholds the agent cannot raise on its own. Pair it with receipts: every settlement returns a transaction hash on Base that any auditor can verify.
On the sell side, agents and endpoints accumulate reputation the same way businesses do — through scored behavior: on-time delivery, quality ratios, intact bonds. SolvScore underwrites agent credit against exactly those signals, so a counterparty you have never met arrives with a number instead of a promise.
The agent-ready checklist
| Capability | What ships it | Status |
|---|---|---|
| Structured tools instead of DOM scraping | WebMCP (document.modelContext.registerTool) | Spec — origin trial |
| Per-call payment, no accounts | x402 over HTTP 402, USDC on Base | Live today |
| Settlement verification | Facilitator verify + on-chain settle | Live today |
| Proof of delivery | Signed I/O-log escrow | Live today |
| Agent discovery | Directory listing with price-honesty probing | Live today |
| Buyer budgets + receipts | Spend authorities + tx hashes on Base | Live today |
The storefronts that win the agent-commerce wave will not be the ones with the slickest checkout for humans. They will be the ones where an agent can find the product, pay for it, and prove it got what it paid for — without a single screenshot.