Skip to main content
Your app can buy a product when its price falls under a limit. Crossmint does not watch prices. Your app starts a checkout on a schedule, and the spending cap stops the checkout while the total is too high. When the total is under the limit, an order intent that the user approved before pays for the order.

Prerequisites

  • Agent Checkouts integration — complete the quickstart and Pay for a Checkout.
  • A scheduler — a cron job or a queue in your backend that starts a checkout at fixed times.
  • Keys — a production server key with the Agent Checkouts scopes, and a client key with order-intents.create and order-intents.read.

Watch the Price and Buy

1

Ask the user to approve the limit

Create an order intent for the limit, for as long as you watch the price. The user approves it one time, in your app. Omit merchant: Agent Checkouts gives the merchant when it pays.
Verify the card rail if it is pending_verification, and store the orderIntentId. See Approve an Order Intent.
2

Start a checkout on a schedule

On each run of your scheduler, start a checkout with maxCost equal to the limit:
A buyer profile gives the shipping address, so that the checkout does not stop to ask for it.
3

Act on the result

Follow the checkout and act on what happens. Run only one checkout at a time for this purchase: do not start the next scheduled checkout while one is still active.

Common Gotchas

Each checkout that reaches the payment step can use the order intent while its available amount covers the total. Run one checkout at a time, stop the schedule before you answer a payment request, and cancel the order intent after the purchase.
Crossmint bills each checkout that starts, also when it ends as blocked. Check at a reasonable interval, for example once a day.
maxCost applies to the total of the order. Tell the user that the limit includes shipping and tax.
When the saved card has no network rail, the checkout uses the encrypted card, which needs the card’s security code. Crossmint keeps the code for a limited time. Ask the user to enter the CVC again, then answer the new payment request.
The payment answer fails after the order intent’s expiresAt. Ask the user to approve a new order intent, or stop the schedule.

Next Steps

Check a Price Without Buying

Get the exact total of an order

Statuses, Results, and Errors

Handle every result of a checkout

Create a Checkout

Review the complete create request schema