Skip to main content
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.

Prerequisites

  • Agent Checkouts integration — complete the quickstart.
  • 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 gives the shipping address that the total depends on.
2

Read the total from the payment request

Follow the checkout 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:
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:
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.

Common Gotchas

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.
Crossmint bills each checkout that starts, also when you cancel it.

Next Steps

Buy When the Price Drops

Buy automatically under a limit

Pay for a Checkout

Answer a payment request with an order intent

Create a Checkout

Review the complete create request schema