Skip to main content
Use Agentcard’s Purchase API to let your agent buy things online without building merchant integrations or using an agent browser. Merchants supported today include Amazon, Walmart, Target, Best Buy, and many more.

Where agents can buy

Here are a few examples of merchants supported today:
Amazon logoAmazon
Walmart logoWalmart
Target logoTarget
Best Buy logoBest Buy
Home Depot logoHome Depot
Lowe's logoLowe’s
Macy's logoMacy’s
Wayfair logoWayfair
Staples logoStaples
Kohl's logoKohl’s
B&H Photo logoB&H Photo
DoorDash logoDoorDash
Gomry logoGomry
Good Eggs logoGood Eggs
Locale logoLocale
Ophelia logoOphelia
Reservations
Flights
For the live list, call GET /buy/merchants with the same bearer token you send to /buy.

What you need

  1. A user with a card in the Vault (Adding a card).
  2. A user-scoped bearer token.
    • /buy always runs as a single user, so org tokens are rejected.
    • Use the user’s connection access_token, or mint a buy_token for a cardholder you own:
Recommended: set a client timeout of at least 120 seconds. Each turn runs against a live merchant.

Quickstart

Every call is a POST /buy. A single purchase follows a turn-based loop, tied together by conversation_id.

1) Start (send an ask)

If your app manages the user’s addresses

Send the address as data instead of prose. Pass delivery_address on every call for the conversation, starting with the first. That includes the call that asks for the cart and the call that confirms it. The agent ships to exactly these values, never asks the user to confirm or correct them, and does not read or update the wallet’s saved default address for that conversation. Re-sending the same address costs nothing. It keeps the original binding, so a cart shown earlier still confirms. A different address replaces the old one. Send it late and the order fails. A cart is bound to the address that was set when the cart was shown, so a cart shown before your first delivery_address cannot be confirmed against it. A confirm of that cart is refused:
Ask for the cart again and confirm the hash that call returns.
street, city, state (a two-letter state or province code) and zip (a US ZIP or a Canadian postal code) are required. address2, phone, name, can_leave_at_door and country (ISO 3166-1 alpha-2) are optional; retail shipping needs phone. A malformed address is refused with 400 invalid_delivery_address and a message naming the problem, before any turn runs. For a merchant account the user linked that keeps its own address book (DoorDash, for example), the agent picks the saved entry that matches the address you sent, and says so when none does.

2) Loop: reply → ask (until a cart is ready)

If the API needs more info, it responds with status: "needs_input" and a natural-language reply. Show reply to the user, then send the user’s answer back as the next ask with the same conversation_id:
Repeat this loop as needed. Nothing can be charged during it.

3) Read the cart (use structured fields)

Once the API has enough details, the response includes a cart and a cart.hash. Use these structured fields (not the prose) to show the user exactly what will be purchased.
The same response carries the search as data in catalog, with a link and a photo per product:
Notes:
  • unmatched lists anything requested that didn’t make it into the cart (plus a reason). Show it instead of guessing from the prose.
  • catalog.items is the last search as data: each item’s id is the merchant’s product link and image_url its photo when the merchant has one. Show the photo and send the link from these fields; a URL your agent composes from the product name is a 404 on the user’s phone. catalog is null on a turn that did not search again, so keep the last one.
  • The status can still be needs_input here, because the API is asking for confirmation.
  • If the user wants a change (for example, “make it two bags”), send that as another ask. You’ll get an updated cart with a new hash.

4) Confirm the cart hash (and choose a payment source)

When the user wants to proceed, confirm the exact cart you showed by sending the cart.hash (not a free-form “yes”). To pay with the user’s own card, pass payment_source: "vault".

5) If approval is required: send the approval URL, then retry confirm

A confirm may pause while the user approves:
This is a pause, not a verdict. Nothing was charged. Send approval_url to the user. After they approve with their passkey, repeat the same confirm call from step 4. When the purchase is placed:

The fields you branch on

Edge cases

If the price changed

A confirm authorizes one cart at one price. If anything drifted since the cart was shown, confirm returns 409 with a fresh cart and a new hash. Show the user the new total, then confirm the new hash.

If the destination changed

A cart is also bound to the address it was shown for, so a confirm is refused when that address is no longer the one bound to the conversation. Two code values say which case it is: Nothing was replaced in the second case. The ordering was wrong, and the fix is to send the address earlier. Both refusals carry the current cart and carts, so you never have to guess the new hash.

Track the order

Retail orders confirm asynchronously (often ~1 minute after placement).
This returns the retailer’s order number, delivery window, final total, and shipments once a package ships. Or listen for the order.placed and order.confirmed webhooks instead of polling.

If a confirm times out

Don’t resend. First, read the conversation:
Wait for turn_in_progress to clear, then check orders. A duplicate confirm while a turn is running returns 409 turn_in_progress, so the same cart can never place twice.

Over MCP

The same loop is available as the buy tool on https://mcp.agentcard.sh/mcp, using the same bearer. The agent relays each turn, the user confirms in words, and the tool places the order.

Sandbox

Sandbox runs the real loop against real merchants up to the confirm. The confirm returns declined with decline_code: "sandbox_mode" by design, because sandbox cards can’t pay a real merchant. Everything before it (conversation, cart, hash) is identical to production.