DEV Community

whiteknightonhorse
whiteknightonhorse

Posted on

Your analytics shows AI agents on your site. Here is how we let them pay

Your analytics already shows AI agents visiting your site, so give them a way to buy from you.

Some of them say who they are in the user agent (ChatGPT-User, PerplexityBot, Claude-User). Others drive an ordinary browser and only show up as odd sessions. They open product pages and read prices, and very few of them get past checkout.

What stops an agent at checkout

A card checkout assumes a person. The card belongs to someone, and the issuer texts a 3-D Secure code to that someone's phone. An agent working at three in the morning has no phone to read it from. Some shops add a CAPTCHA on top. Behind all of it is a bank account, and banks open accounts for people and companies, not for programs.

A crypto wallet asks for none of that. It is a key pair that a program can hold. The owner tops it up with twenty dollars of USDC and sets limits in the agent's wallet client (Coinbase's Payments MCP and Tempo access keys both have per-payment and per-session caps). After that the agent can sign a payment on its own, within those limits.

The agent then has money it is allowed to spend. It still needs a checkout that takes a signature instead of a card number.

The shop's side: one link

We built that checkout as part of APIbase and called it Integrator. A shop adds a link to a product page:

<a href="https://apibase.pro/m/your-shop/p/tote" rel="alternate payment">
  Buy with your AI agent
</a>
Enter fullscreen mode Exit fullscreen mode

Buy with your AI agent

Customers keep using the checkout they know. An agent that follows the link reaches the shop's own storefront, an MCP endpoint with eight tools: search, get, quote, pay, order status, cancel, and two for subscriptions. It sees this shop's catalog and nothing else.

What happens after the click

What happens after the click

The agent first asks for a quote. The quote freezes the price, holds the stock and carries a nonce that works once. It expires after a few minutes, so an agent can't sit on an old price.

Then the agent pays exactly that quote in USDC. On Base it uses x402; on Tempo it uses MPP. The transfer goes from the buyer's wallet to the shop's payout wallet; APIbase never holds the funds. We do sit in the order flow: we read the payment, compare the amount and the recipient with the quote, and release the order to the shop once the receipt is in.

The cases we spent most time on were the failures:

  • An authorization for a different amount or a different recipient gets payment_amount_mismatch before anything settles.
  • Sending the same payment twice returns the stored result. The shop never ships twice.
  • If two agents pay one quote at the same moment, one payment goes through and the other gets 409 quote_already_paying.

Why x402 and MPP

Why x402 and MPP

HTTP has had status code 402, Payment Required, since the 1990s, and almost nobody used it. x402 gives it a body. The server answers with what it wants paid, the client signs a USDC authorization and repeats the request. Coinbase publishes the protocol and client libraries for it, and on Base the facilitator pays the gas, so the buyer needs only USDC.

MPP, the Machine Payments Protocol on Tempo, comes at it from the chain side. Tempo charges network fees in a stablecoin, so an agent never has to hold a separate gas token. Splits and payment sessions are built in, and those are what a pay-per-second stream or a subscription that renews itself needs.

A shop gets both by default and doesn't have to know which client a buyer runs.

Running it with ten agents before telling anyone

Before writing this, we ran ten of our own Sonnet agents against the live system. Each one played a different shop, built a small storefront page, connected it using only the public docs, and then bought from it as a customer. Together they paid 14 orders on mainnet. Each payment arrived once, at the right wallet, for the quoted amount. Connecting a shop took six API calls after the wallet was set up; in those runs a purchase took four tool calls and about a second and a half from the quote request to the paid response on Base.

The same agents found bugs. One of them was serious enough that we fixed it before publishing this post. The agent that only had the landing page and the setup guide also wrote down every place where it would have asked a human for help, and those gaps are going into the guide.

What stays with the shop and the buyer

The fee is 0% while the pilot runs; under our terms any change is announced 30 days ahead. You need a wallet that can receive USDC on Base or Tempo. We don't issue wallets and never ask for keys.

Spending limits are the buyer's to set, in their wallet client. Refunds follow the policy the shop publishes. When a product needs personal data, for example a passport number for a tour, the buyer's agent encrypts it with the shop's key and we pass along a sealed envelope.

For most shops agent traffic is still small. If you want to see what an agent sees before adding anything, open the demo shop below or point your own agent at it.

Demo shop: https://apibase.pro/m/apibase-demo
Setup guide: https://apibase.pro/integrator

Top comments (0)