Skip to main content
The Purchase API is a turn-based loop on one endpoint. You send what the user wants as plain text in ask, follow up with the same conversation_id, and place a shown cart by echoing its hash in confirm. Money moves only on a confirm, and only for exactly the cart the hash describes. The bearer names one person, because a purchase always runs as one user. A user token names that person itself: the connection access_token or a cardholder buy_token. A company that calls from its own server sends its platform access token and names the connected person with user_id, in the body of a POST and in the query of a GET. Use a client timeout of at least 120 seconds.

The purchase response object

Every 200 from POST /buy carries the same envelope. Each field is always present and null when empty. max_total_below_estimate means the max_total_cents sent with the confirm is below what the cart costs before shipping and tax. Nothing was charged. Confirm the same cart again with a higher cap.

The cart object

The presence of chargeUpToNote does not establish that the assistant repeated the explanation in reply.

The catalog object

Show your own product list from catalog instead of reading the results out of reply. catalog holds the last product search in the conversation, on the turn that searched and on the turns after it. Fifteen minutes after that search, catalog is null, because prices and item ids can change by then. Send a new ask to search again. Match a retail cart line to its search result: the line’s product_id and the item’s id are the same product page URL. Other merchants use their own item id. Check for priceCents before you show a price. An item leaves out a field it does not have instead of sending null, unlike the fields of the purchase response object. A restaurant reservation time slot never has a price. A retail search drops any product listed without a price, because a cart cannot hold it. An item without a picture has no image_url.
Show image_url where your app can render an image (a chat bubble, a card) and send id when the user wants the page. Both come from the merchant; never build either from the name.

Endpoints

Webhooks: order.placed, order.failed, order.confirmed, order.updated. The guide is Agentcard’s Purchase API.