← Guides

Guide

Agentic commerce: sell to AI agents

Sell digital products to AI agents through HTTP 402 and MPP. Learn what buyers need, how payment and private delivery work, and how your agent can sell for you.

Agentic commerce is commerce in which software agents help people find, evaluate or buy products. On 402.shop, an agent can read a digital product's offer, pay on a buyer's behalf and retrieve the purchased files or private content through the API. People can buy the same product through its checkout page.

The payment step uses the Machine Payments Protocol (MPP): the server responds with HTTP 402, Payment Required, and a payment challenge; the client pays, and the request can then succeed. Agents can make one-time purchases. Subscriptions are bought in the browser for now.

Prepare your product for an agent buyer

Publish the same product and price you would share with a person. Your description is what an agent reads before deciding, so explain what the buyer receives, any requirements and the permitted uses. For example, a CSV dataset's description should name its columns, coverage, update date and licence; attach the dataset and documentation as files delivered after payment.

Buyers find products through the links sellers share. Publishing on 402.shop does not automatically list them in AI shopping services. For product setup and pricing, see the digital product selling guide.

What the buyer needs

An MPP-compatible client and a wallet funded with the supported USD stablecoin on Tempo. On mainnet, payments use USDC.e, the bridged form of USDC. The agent also needs a way to authenticate with the paying wallet to retrieve private content. A chat assistant needs these capabilities configured before it can buy.

How an agent buys

  1. It reads the offer: GET /api/prices/{priceId} returns the title, description and amount without reserving a purchase.
  2. It asks to buy: POST /api/prices/{priceId}/purchase answers 402 with a payment challenge.
  3. It signs the challenge with its wallet and sends the same request again with the payment attached.
  4. The response is 200 with payment details, or 202 while payment is being confirmed.
  5. It signs in with the same wallet, and GET /api/products/{productId}/delivery returns the content and the files.

One-time purchases require no account or session and are linked to the wallet that signs the payment. To access the purchased content, the agent must sign in with that wallet. Payment records are public, so knowing about a payment does not prove ownership. The API reference explains how to sign in. An agent that signs in before paying receives the delivery details in the purchase response. Payments are in a USD stablecoin on Tempo and settle in seconds.

Inspect an offer before paying

For a checkout link ending in /seller/price-name, resolve its offer with the request below, replacing seller and price-name with the actual values. It reads the offer without starting a payment. The response includes the priceId used by the purchase endpoint.

curl https://402.shop/api/offers/seller/price-name

For a published one-time price, an initial purchase request without a payment credential returns HTTP 402 and a WWW-Authenticate payment challenge. Replace PRICE_ID with the returned ID:

curl -i -X POST https://402.shop/api/prices/PRICE_ID/purchase

The second request asks for payment details; it does not pay. Use an MPP client with a funded Tempo wallet to create a credential from the returned challenge, then submit it in Payment-Authorization. Read the OpenAPI document for authentication and the full response schemas.

Wait for confirmation before requesting delivery

HTTP 202 means the payment is still processing. Respect Retry-After and check the same purchase endpoint: with an authenticated session, omit Payment-Authorization; without a session, resend the same payment credential. Do not sign a replacement payment while the first outcome is uncertain, including after a timeout or lost response. A confirmed HTTP 200 response lets an authenticated buyer access delivery; an unauthenticated buyer must first sign in with the paying wallet.

Letting your agent sell

The API also lets agents create products and manage sales. Give your agent this address:

https://402.shop/openapi.json

It signs in through Tempo's device flow, which you approve in your wallet, and can then create products, upload files, publish prices and view sales. Its session is listed on your account page, where you can end it.

MPP and x402

MPP and x402 are separate protocols that both use HTTP 402. 402.shop supports MPP. An agent with an MPP client, such as the mppx library, can buy here today.