On this page
For people who hand a wallet to a trusted agent, and for the agents themselves. Fee for the seller: 0% (pilot); buyers pay the quoted total and nothing on top. fee_disclosed: false in a quote says the same: the seller pays the platform fee out of total_usd, so the quote does not itemise it.
Find a shop
Each shop has its own MCP storefront at https://apibase.pro/mcp/m/<slug> with eight tools: search, get, quote, pay, order get, cancel, subscription get, subscription cancel. Find shops with apibase.discover: pass what the buyer wants as intent; shops come back as results of kind: "merchant" (add kind=merchant to get shops only). A public page for each shop lives at /m/<slug>.
Set limits in your wallet
Limits live in the wallet, not in the prompt: a prompt can change what an agent wants; it cannot change what its wallet can sign.
- Per payment and per session: set both in the client (Coinbase Payments MCP, or
@x402/fetchspendControls; the $1 default is described in /integrator/agent-guide#x402-clients-and-the-1-default-cap). An agent that reaches a limit stops and asks you. - Per agent: one wallet, or one Tempo access key, per agent, funded with its share (see "Several agents, one budget" below).
- The sum: a cap set inside one shop's account covers that shop only; with ten shops you have ten caps and nothing that adds them up. The paying wallet is the one place that does: fund it with the budget, and every shop, API and agent draws from the same ceiling.
- Human confirmation: when a quote carries
requires_human_confirmation(total abovelimits.human_confirm_above_usd, default $100), the client asks the human first (see /integrator/docs#quotes).
How to get a wallet: /integrator/wallet.
Several agents, one budget
Neither APIbase nor any shop imposes a cap across several agents or wallets: nobody here holds your keys or your balance. How you fund and authorize the agents' wallets enforces a shared budget.
- On Base (x402, USDC): the wallet that holds the USDC signs a payment, so each agent's hard cap is the balance of its own wallet. Give every agent its own wallet, fund each one with only its share, and top them up from one treasury wallet on your own schedule. The fleet budget is the sum you fund; an agent that runs dry stops and asks you. Keep the per-payment and per-session limits in each client as before.
- On Tempo (MPP): keep one funding wallet and authorize one access key per agent with a spending limit and an expiry (the same
accessKey.authorizestep described under subscriptions below). The sum of the limits is the fleet budget; revoke one key to stop one agent without touching the others. - What the server can see: the boundary is the paying wallet, not an agent or a session. A mutated request is a new purchase, and idempotency never prevents it. Cross-agent budgets live in how you fund wallets, or in an agent-side budget middleware of your choice.
- What you can reconcile against: every order you pay can be read back with
shop.order.get, which returns the state, the transaction hash and the refund policy.
If you need a cap enforced by the shop rather than by the wallet, write to support@apibase.pro — today we deliberately do not hold that role.
The price is fixed by the quote
A quote is a price snapshot with a stock hold, valid for a stated number of minutes. The agent pays exactly the quoted total, to exactly the shop's payout wallet. A signed authorization for any other amount or address is refused (payment_amount_mismatch).
One expires_at covers the whole quote: every line shares the same price snapshot and the same stock hold, and an open quote is never repriced. Nothing is sent to you before it expires, so read pay_before before you sign. pay_before is the one deadline to act on: send the payment before it. It is expires_at minus 60 seconds, because settlement can take up to 30 seconds. The Tempo challenge expires (5 minutes) and the x402 maxTimeoutSeconds (120) are not deadlines of the quote: an expired challenge is replaced when you read the pay URL again, and maxTimeoutSeconds bounds the life of the authorization you sign. Past pay_before, let the quote expire and read it again: 410 quote_expired carries a fresh quote at current prices (see /integrator/docs#quotes). The fresh quote is a new price. The 410 also lists the prices that moved in changes (the total, the shipping price and each line whose unit or variant price changed); changed: false covers prices only, and a fresh quote of a subscription can also change subscription_terms (period, max_periods): the full list of what a fresh quote may change is at /integrator/docs#quotes. Compare its total_usd with the old one by a rule set in your client's configuration (for example: accept the same or a lower total, ask the human for anything higher), not by the model's judgment; requires_human_confirmation applies to the fresh quote as to any other.
Buy step by step (REST)
POST /api/v1/shop/quoteswith{merchant, items}and no key. An anonymous quote carriesbuyer_token; keep it and send it asAuthorization: Bearer <buyer_token>on every later call for this order (pay, order get, cancel, dispute).buyer_tokenis a secret: whoever holds it reads the delivery and can cancel or dispute this order; never log it or pass it to another party. If you lose it, the paying wallet can still read the order (see /integrator/docs#orders). To drop a quote you will not pay:POST cancel_urlwith the Bearer and no body; free while the order isQUOTED, the held stock is released.GETorPOST /api/v1/shop/quotes/<id>/paywithout a payment is the 402 challenge. Check thataccepts[0].payToequals the shop's payout wallet andamountequals the quote. One pay URL serves both rails, chosen by the header you send:X-Payment(x402, Base) orAuthorization: Payment(MPP, Tempo); the 402 offers both.extensions.payment-identifierin the 402 is optional: an id you add to the payment so that a retry returns the first answer and never pays twice (/integrator/docs#orders).POST /api/v1/shop/quotes/<id>/paywith the signedX-Payment(any x402 v2 client) answers200 paidwithorder {order_id, state, tx_hash, fulfillment?}, or202 payment_pending. Both carryorder_url, the absolute URL of the order; withoutorder.fulfillmentthey also carrynext: the delivery is in the order, not in this reply (GETorder_urlwith the Bearer of step 1 untilFULFILLED).- A
stateofPAIDmeans the shop has not delivered yet: pollGET /api/v1/shop/orders/<order_id>with the Bearer untilFULFILLED.fulfillmentappears there, for the paying identity only (viewer: payer, see /integrator/docs#orders). fulfillmentis always a string. When it begins with{"type":"url"it is the JSON text of{type, urls[]}: parse it. The links are the shop's own and may expire, or the shop may limit them; APIbase does not add or check limits.- Repeating
/paywithout a payment on a quote you already paid returnsalready_placedwith the same order; nothing is charged twice. waive_withdrawal: truein the pay body is yours to send, only for digital content you want delivered without the withdrawal window; the order then closes at once and cannot be cancelled.
The same steps as one runnable script (scripts/shop/examples/buy-rest.ts):
import { x402Client, x402HTTPClient } from '@x402/core/client';
import { ExactEvmScheme } from '@x402/evm/exact/client';
import { privateKeyToAccount } from 'viem/accounts';
// Usage: BUYER_PRIVATE_KEY=0x... npx tsx scripts/shop/examples/buy-rest.ts <merchant-slug> <sku>
const BASE = process.env.APIBASE_URL ?? 'https://apibase.pro';
const [slug, sku] = process.argv.slice(2);
const key = process.env.BUYER_PRIVATE_KEY as `0x${string}`;
if (!slug || !sku || !key)
throw new Error('usage: BUYER_PRIVATE_KEY=0x.. buy-rest.ts <slug> <sku>');
const json = { 'content-type': 'application/json' };
async function main(): Promise<void> {
// 1. Quote. Keep buyer_token: it is the Bearer for every later call on this order. Pay before q.pay_before.
const q = await (
await fetch(`${BASE}/api/v1/shop/quotes`, {
method: 'POST',
headers: json,
body: JSON.stringify({ merchant: slug, items: [{ sku, qty: 1 }] }),
})
).json();
const auth = { authorization: `Bearer ${q.buyer_token}` };
const payUrl = `${BASE}/api/v1/shop/quotes/${q.quote_id}/pay`;
// 2. The 402 probe: payTo and amount must be the quote's.
const probe = await fetch(payUrl, { method: 'POST', headers: { ...json, ...auth }, body: '{}' });
const challenge = await probe.json();
const want = q.pay?.accepts?.[0] ?? q.pay;
const a = challenge.accepts[0];
console.log('402 accepts[0]:', { payTo: a.payTo, amount: a.amount });
if (probe.status !== 402) throw new Error(`expected 402, got ${probe.status}`);
if (want?.payTo && want.payTo.toLowerCase() !== a.payTo.toLowerCase())
throw new Error('payTo differs from the quote');
if (want?.amount && String(want.amount) !== String(a.amount))
throw new Error('amount differs from the quote');
// 3. Signed retry (x402 v2). spendControls caps this client at the quoted amount.
const usd = Number(a.amount) / 1e6;
const client = x402Client.fromConfig({
schemes: [{ network: a.network, client: new ExactEvmScheme(privateKeyToAccount(key)) }],
spendControls: { maxAmountPerPayment: `$${usd}` },
});
const payload = await client.createPaymentPayload(challenge);
const paid = await fetch(payUrl, {
method: 'POST',
headers: {
...json,
...auth,
...new x402HTTPClient(client).encodePaymentSignatureHeader(payload),
},
body: '{}',
});
const reply = await paid.json();
console.log(paid.status, reply.status, reply.state);
// 4. The paid reply carries order.fulfillment for an instant item; otherwise GET order_url until FULFILLED.
let order = reply.order;
for (let i = 0; i < 60 && order?.state !== 'FULFILLED'; i++) {
await new Promise((r) => setTimeout(r, 2000));
order = await (await fetch(reply.order_url, { headers: auth })).json();
}
if (order?.state !== 'FULFILLED') throw new Error(`not fulfilled: ${order?.state}`);
console.log('fulfillment:', order.fulfillment);
}
main().catch((e) => {
console.error(String(e));
process.exit(1);
});Errors: see /integrator/agent-guide#error-codes.
What we never ask for
Integrator never asks for your private keys or seed phrase, in any tool, page or message. A wallet signs one payment authorization per order; you need nothing else. If anything asks for a key, stop.
What you can verify
- APIbase stores no card number, CVV or open address. Personal data a product needs is encrypted under the seller's key before it is sent.
- The payment is an authorization for the exact quoted amount to the exact payout address; you can check the transfer on a block explorer.
- Goods are delivered only after the transfer has a successful receipt.
- You can check every claim above in your own orders:
shop.order.getreturns the state, the transaction hash and the refund policy. The Orders section of the integrator docs defines what each caller sees (viewer:payerorpublic).
What stays outside our guarantees
- Your wallet sets and enforces spending limits.
- Your agent's client does the human confirmation.
- Safekeeping of a seller's key is the seller's.
- Shop refunds for returns or cancellations are the seller's duty under its policy and /legal/refund-framework; so is the seller's part of an order payment that arrived twice or late (refunded to your wallet within 7 days). APIbase refunds automatically the money it itself owes you (a charged call without a result, its own fee share of such a payment): see /pricing#refunds.
- USDC is issued by Circle, which can block addresses under its terms; a lost key means lost funds; stablecoin balances are not insured deposits. Keep agent wallets small and funded from a treasury you control.
Streams: pay by the second
You pay for a stream product with a deposit into a payment channel that pays the seller's wallet: you deposit at least the minimum shown on the product, the agent signs small vouchers off-chain as the stream runs, and the seller settles in batches. The part of the deposit that was not consumed is returned to you. If the seller does not respond, you call requestClose and, after the waiting period, withdraw. After you request a close on-chain you can withdraw the unspent deposit yourself once the grace period of 900 seconds has passed. You pay streams over MPP only, never with X-Payment.
Subscriptions: pre-sign the next periods (Base)
By default an agent renews a subscription by paying each period's quote. On Base you can instead sign the next 1 to 12 periods in advance (shop.subscription.preauthorize): each signature is one USDC authorization for one period, to the shop's payout wallet, for the plan price, valid from the start of that period for at most 72 hours. Nobody can use it for another amount, another recipient or another time. A client that signs a batch with viem is in scripts/shop/examples/preauthorize-base.ts.
To revoke a stored authorization, either cancel the subscription (shop.subscription.cancel: nothing stored is executed afterwards) or cancel it on-chain: call cancelAuthorization(authorizer, nonce, signature) on the USDC contract, where signature signs the CancelAuthorization message for your nonce. An authorization that was canceled on-chain is never executed.
Subscriptions: let the shop renew with its own key (Tempo)
On Tempo a shop can renew your subscription with an access key that it keeps itself. Your agent authorizes only that key's address (accessKey.authorize from viem/tempo) with a spending limit of the plan price times the remaining periods and an expiry, then calls shop.subscription.confirm_pull. The shop pays the gas of each renewal; every renewal is checked on-chain against the plan price, the shop's payout wallet and a memo that names the subscription and the period.
To stop it, cancel the subscription (shop.subscription.cancel: the shop has nothing left to renew) or revoke the key yourself: call accessKey.revoke for the key address from your paying account. A revoked key never renews again; the next period is then yours to pay explicitly.
Subscriptions: let the platform renew with a periodic key (Tempo, day and week plans)
For a plan that renews every day or every week the quote of period 1 can carry pay.mpp_subscription. Pay it with an mppx client (0.9.3 or newer) at POST /api/v1/shop/quotes/<id>/pay?intent=subscription: the 402 challenge has intent subscription, and your client signs one periodic key authorization for a key address that belongs to APIbase. Period 1 is charged right away; the platform renews each later period with that key, which also pays the gas. You never sign a renewal and no private key of yours is stored. shop.subscription.get shows pull_mode: mpp_subscription and renewal_key, the address you authorized.
Which mode applies: none (you pay each period's quote), base_preauth (Base, signatures stored ahead), tempo_keychain (the shop renews with its own key) and mpp_subscription (this one, day and week plans only; monthly plans keep the other modes).
To stop it, cancel the subscription (shop.subscription.cancel ends all renewals but does not touch the chain) and revoke the key yourself: call accessKey.revoke from viem/tempo for the renewal_key address from your paying account. If the key is revoked, expired or its limit no longer covers a period, the period stays unpaid and you pay the renewal quote explicitly before it is canceled unpaid.
If a payment is slow
The order stays in PAYING and the call answers 202 payment_pending. Do not pay twice: read the order with shop.order.get until its state changes.
Refunds
APIbase sends the refunds it owes weekly (Mondays, UTC), to the wallet that paid. You can see what is owed on the receipt (refund_url) or in shop.order.get. APIbase sends a refund once the amount owed exceeds ten times the network fee of sending it; smaller amounts carry forward and never expire. Details: /pricing#refunds.