> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crossmint.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Check a Price Without Buying

> Get the exact total of an order, with shipping and tax, and stop before the payment

A product page often does not show the final price. Shipping, tax, and discounts appear only at the checkout. To get the exact total, run a checkout to the payment step, read the amount, and cancel the checkout. Nothing is bought.

<video autoPlay muted loop playsInline src="https://mintcdn.com/crossmint/eLFFFOlQTcnBWJ-s/images/agents/checkouts/price-check.mp4?fit=max&auto=format&n=eLFFFOlQTcnBWJ-s&q=85&s=78e053d7faf643950adbca0e9cee78d6" />

## Prerequisites

* **Agent Checkouts integration** — complete the [quickstart](https://docs.crossmint.com/agents/agent-checkouts-quickstart.md).
* **Server key** — a production key with `agent-checkouts.create`, `agent-checkouts.read`, `agent-checkouts.update`, and `agent-checkouts.cancel`.

## Get the Total

**1. Start the checkout**

Give the product and its options in the task. Set `maxCost` above the price that you expect, so that the checkout can reach the payment step. A [buyer profile](https://docs.crossmint.com/agents/checkouts/configure.md) gives the shipping address that the total depends on.

```typescript theme={null}
const BASE_URL = "https://www.crossmint.com/api/unstable/agent-checkouts";
const headers = {
    "Content-Type": "application/json",
    "X-API-KEY": process.env.CROSSMINT_SERVER_API_KEY!,
    "x-crossmint-user-id": "YOUR_USER_ID",
};

const response = await fetch(BASE_URL, {
    method: "POST",
    headers,
    body: JSON.stringify({
        request: {
            startUrl: "https://shop.example.com/products/wireless-headphones",
            task: "Go to the checkout for one pair of the wireless headphones in black, with standard shipping.",
        },
        buyerProfileId: "YOUR_BUYER_PROFILE_ID",
        constraints: { maxCost: { amount: "500.00", currency: "USD" } },
    }),
});
if (!response.ok) {
    throw new Error(`Could not start checkout: ${response.status}`);
}
const { runId } = await response.json();
```

**2. Read the total from the payment request**

[Follow the checkout](https://docs.crossmint.com/agents/checkouts/follow-run.md) and answer its questions. When it reaches the payment step, the status is `awaiting_input` and the question is a payment request. When `interaction.amount.kind` is `"exact"`, `interaction.amount.value` is the total:

```json theme={null}
{
    "kind": "payment",
    "purpose": "checkout_payment",
    "method": "card",
    "amount": { "kind": "exact", "value": "348.00", "currency": "USD" },
    "merchant": { "name": "Example Shop", "url": "https://shop.example.com", "countryCode": "US" }
}
```

When `amount.kind` is `"maximum"`, `amount.value` is your spending cap, not the total: the merchant did not show a final total before the payment. Do not show it as the price.

**3. Cancel the checkout**

Do not answer the payment request. Cancel the checkout:

```typescript theme={null}
// Uses BASE_URL, headers, and runId from the first step.
const cancelResponse = await fetch(`${BASE_URL}/${runId}/cancel`, { method: "POST", headers });
if (!cancelResponse.ok) {
    throw new Error(`Could not cancel checkout: ${cancelResponse.status}`);
}
```

The cancel request returns `202 Accepted`. Keep reading the checkout until its status is `cancelled`.

**4. Show the total**

Show the total to the user. To buy later, start a new checkout and pay with an order intent. See [Pay for a Checkout](https://docs.crossmint.com/agents/checkouts/payments.md).

## Common Gotchas

> **The total changes before the purchase**
>
> Prices, shipping, and stock can change. The total of a later purchase can be different. Set `maxCost` on the purchase to the highest total that the user accepts.

> **Each check costs a checkout**
>
> Crossmint bills each checkout that starts, also when you cancel it.

## Next Steps

> **[Buy When the Price Drops](https://docs.crossmint.com/agents/checkouts/use-cases/buy-when-the-price-drops.md)**
>
> Buy automatically under a limit

> **[Pay for a Checkout](https://docs.crossmint.com/agents/checkouts/payments.md)**
>
> Answer a payment request with an order intent

> **[Create a Checkout](https://docs.crossmint.com/api-reference/agent-checkouts/create-agent-checkout.md)**
>
> Review the complete create request schema
