Skip to main content
Send the agent a product URL and a task. It navigates the merchant’s checkout, asks your application for missing inputs or payment authorization, and returns the purchase result.

Try the Live Demo

Explore the complete experience in a working app

View the Sample App

Use the full integration as a reference for your app

Prerequisites

  • API key: A production server-side key with agent-checkouts.create, agent-checkouts.read, agent-checkouts.update, and agent-checkouts.cancel scopes from the Crossmint Console
  • Buyer identity: A stable identifier for your user, sent as x-crossmint-user-id on every request
  • Purchase task: A product URL, the variant and quantity to buy, and a spending cap
  • Card authorization: To complete a card purchase, a saved and registered card, plus a client-side key and buyer JWT as described in Authorize Payments
Use the same user ID as your JWT’s configured user ID claim (sub by default), so the checkout and its card authorization belong to the same buyer. Agent Checkouts does not support staging. These examples run on your backend; keep the server key out of browser code. For direct browser calls, see Authenticate Each Request.
Agent Checkouts and the live demo can place real orders. Use a task and spending cap that you intend to authorize.

Run a Checkout

1

Start the checkout

Set these variables in your terminal. Reuse them in the following steps:
Replace the sample URL and task with your intended purchase, then create a run:
cURL
The response contains a runId. Save it for subsequent calls:
To prefill shipping details or set the browser country, see Configure a Checkout.
2

Read the run

Read its current status and any request waiting for your application:
cURL
While the run is active, repeat this read every 2 seconds. When status is "awaiting_input", handle requiredAction. Your application chooses how to present the request: in a web page, a native app, or a conversation.For live updates and conversation history, see Follow a Run. You can optionally display the agent’s browser using run.browser.embedUrl once run.browser is available.
3

Answer the request

Copy requiredAction.requestId into your response. For example, if a form requests a standard field whose key is email, send the buyer’s answer:
cURL
Each submission answers the complete request: include all required fields, and omit optional fields left unanswered. Handle Buyer Inputs shows the field types, ordinary rendering, and protected collection.When the agent asks for payment, follow Authorize Payments to create an order intent for the request’s amount and merchant using the same buyer’s saved card. Complete any verification, then submit this body to the same messages endpoint:
Use a unique message id for each answer. If you retry after a lost acknowledgement, resend the same ID and body. A payment answer contains the order intent ID; it never contains card details.
4

Read the result

After each answer, resume reading the run and handle further requests until it finishes. A read can briefly show a request you already answered; handle each requestId only once, retrying its original message if needed.At a terminal status, read the result:An accepted answer resumes the agent. The final run status tells you whether the purchase succeeded.To stop an active run, request cancellation and keep reading until it reaches a terminal status:
cURL
See Finish or Cancel for the complete result behavior.

Launching in Production

Agent Checkouts already uses production credentials. Before serving buyers, add streaming and recovery, buyer input handling, and payment authorization for your application’s user experience. The sample app above shows how these pieces fit together. If a create-run acknowledgement is lost, inspect List Checkouts before creating another run.

Learn More

Configure a Checkout

Prefill buyer details and set merchant guidance

Follow a Run

Stream updates, steer the agent, and recover after disconnects