# Checkout checkpoints

> Check an agent's rules right before it opens Link or another payment method, and again right before it pays.

- Human URL: https://conto.finance/docs/guides/checkout-checkpoints
- Raw Markdown: https://conto.finance/docs/guides/checkout-checkpoints.md
- Terminal view: https://conto.finance/ai/docs/guides/checkout-checkpoints

Documentation group: Agentic commerce

When your agent completes a checkout itself, call Conto at two points: right before it opens the
payment method, and right before it submits the payment. Conto checks the agent's rules at both,
counts the amount toward its limits in between, and records the outcome your agent reports.

You need an agent and a standard SDK key, which has every scope these calls use. No wallet is
needed.

```bash
npm install @conto_finance/sdk
```

## The two checkpoints

| When                                                | Call                         | Continue only if                   |
| --------------------------------------------------- | ---------------------------- | ---------------------------------- |
| Before Link, a card form, Shop Pay, or PayPal opens | `checkout.begin()`           | The stage is `APPROVED`            |
| While the owner reviews the purchase                | `checkout.waitForApproval()` | It returns the approved checkpoint |
| Right before the payment is submitted               | `checkout.confirm()`         | The stage is `CONFIRMED`           |
| After the payment                                   | `checkout.reportOutcome()`   | Always report it                   |

New organizations start with these limits: $25 per transaction, $100 a day, and owner approval
above $10. The $15 purchase below fits under the cap and goes to the owner for approval. See
[starter guardrails](https://conto.finance/docs/policies/overview#starter-guardrails-for-new-organizations).

```typescript

const conto = new Conto({ apiKey: process.env.CONTO_API_KEY! });

let checkpoint = await conto.checkout.begin({
  idempotencyKey: order.id,
  merchant: { id: 'acme-retail', name: 'ACME Retail', checkoutUrl: page.url() },
  amountMinor: 1500,
  purpose: 'Phone charger the shopper chose',
  lineItems: [{ name: 'USB-C phone charger', quantity: 1, unitAmountMinor: 1500 }],
});

if (checkpoint.stage === 'AWAITING_APPROVAL') {
  // The owner reviews the purchase. Throws if they reject it or the request expires.
  checkpoint = await conto.checkout.waitForApproval(checkpoint, { timeoutMs: 15 * 60_000 });
}

// Open Link. The buyer signs in and the final total appears.

const confirmed = await conto.checkout.confirm(checkpoint, {
  amountMinor: finalTotal,
  lineItems: observedItems,
  totals: finalTotals,
});

// Submit the payment.

await conto.checkout.reportOutcome(confirmed.id, { outcome: 'PAID', reference: orderNumber });
```

If any call throws, stop the checkout. A denial at either checkpoint throws an error, and the
amount stops counting toward the agent's limits. For a Link checkpoint whose Link request Conto
has, the amount stays counted until you cancel the Link request and then the checkpoint. A checkpoint
cancel does not close a Link card, so cancel the Link request first.

## When the owner must approve

When the agent's rules require approval, `begin()` returns the stage `AWAITING_APPROVAL` with
`nextAction: WAIT_FOR_APPROVAL`. Conto holds the spend against the agent's limits and sends the
owner an approval request in **Inbox**. The organization's
[approval workflow](https://conto.finance/docs/guides/approval-workflows) sets who can approve it. Do not open the payment
method while the checkpoint waits.

The checkpoint carries the request:

```json
{
  "stage": "AWAITING_APPROVAL",
  "nextAction": "WAIT_FOR_APPROVAL",
  "expiresAt": "2026-10-05T15:00:00.000Z",
  "approval": {
    "requestId": "cmg8x2k1p0004l70a9c3d7f2e",
    "status": "PENDING",
    "expiresAt": "2026-10-05T15:00:00.000Z"
  }
}
```

`approval.status` is `PENDING`, `APPROVED`, `DENIED`, `EXPIRED`, or `CANCELLED`. While the
checkpoint waits, `expiresAt` is when the owner's decision window closes. The request expires when
its approval workflow does, and no later than 24 hours after `begin()`.

`waitForApproval(checkpoint, options)` reads the checkpoint until the owner decides. It returns the
approved checkpoint, with stage `APPROVED`. The 30 minutes to confirm start at the approval.

| Option           | Default    | Meaning                                            |
| ---------------- | ---------- | -------------------------------------------------- |
| `timeoutMs`      | 10 minutes | Stop waiting after this long. The spend stays held |
| `pollIntervalMs` | 5 seconds  | Time between reads. The minimum is 1 second        |
| `signal`         | None       | An `AbortSignal` that stops the wait               |

### Errors

Each error has a `checkpoint` property with the checkpoint as Conto last returned it.

| Error                           | When                                                              | What to do                                                                       |
| ------------------------------- | ----------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| `CheckoutApprovalDeniedError`   | The owner rejected the purchase                                   | Do not pay. Conto released the spend                                             |
| `CheckoutApprovalExpiredError`  | The request expired before the owner decided                      | Do not pay. Conto released the spend                                             |
| `CheckoutApprovalTimeoutError`  | `timeoutMs` passed before the owner decided                       | Wait again, or cancel the checkpoint to release the spend                        |
| `CheckoutApprovalPendingError`  | The checkpoint still needs approval when you call `confirm()`     | Call `waitForApproval(error.checkpoint)`, then confirm the checkpoint it returns |
| `CheckoutCheckpointClosedError` | The checkpoint is already denied, cancelled, expired, or not paid | Stop this checkout. Start a new purchase with a new idempotency key              |

`CheckoutApprovalDeniedError` and `CheckoutApprovalExpiredError` extend
`CheckoutCheckpointClosedError`. `begin()` throws `CheckoutCheckpointClosedError` when you retry it
with the key of a checkpoint that already closed.

### Reject, expire, cancel, or unknown outcome

- **The owner rejects the purchase.** The stage becomes `DENIED`, and Conto releases the spend.
- **The request expires.** The stage becomes `EXPIRED`, and Conto releases the spend.
- **The agent cancels while it waits.** Conto withdraws the approval request and releases the
  spend. The stage becomes `CANCELLED`.
- **The outcome is unknown.** The stage becomes `OUTCOME_UNKNOWN` and the spend stays held. This
  happens when you report `UNKNOWN` or `NOT_PAID`. It also happens when a Link checkpoint whose Link
  request Conto has lapses, or `confirm()` refuses it because the approval lapsed or a rule now denies
  it. That checkpoint has `linkRequestOpen: true`. Cancel the Link request and then the checkpoint to
  release the spend. Otherwise the owner records what happened.

Until the owner approves, the confirm endpoint returns `409 APPROVAL_REQUIRED` and the SDK's
`confirm()` throws `CheckoutApprovalPendingError`. Retrying `begin()` with the same key returns the
same waiting checkpoint.

## The merchant is the checkout domain

Conto names the merchant by the registrable domain of `checkoutUrl`. Case and a leading `www.` do
not matter. `https://WWW.Example.com/cart` and `https://shop.example.com/checkout` are both the
merchant `example.com`. Stores on a shared store platform's domain each count as their own
merchant.

- Allow and block lists, payee status, and velocity rules with `RECIPIENT` scope use that domain.
- A list entry for `example.com` also covers `shop.example.com`.
- [Store rules](https://conto.finance/docs/policies/advanced#connected-card-store-rules) match the host of `checkoutUrl` the
  same way.
- `merchant.id` and `merchant.name` are labels the owner sees. Write list entries as domains.
- `checkoutUrl` must use the store's domain name. `begin()` refuses an IP address or a single-word
  host such as `localhost` with `400`.

See [checkout purchases](https://conto.finance/docs/policies/evaluation#checkout-purchases) for how rules count them.

## HTTP endpoints

If your integration calls the HTTP API directly, use an agent SDK key with the scope for each step.
All paths below begin with `/api/sdk` and return `{ "checkpoint": { ... } }` with an `id`, `stage`,
`nextAction`, and `expiresAt`.

| Step                  | Method and path                                     | Scope               |
| --------------------- | --------------------------------------------------- | ------------------- |
| Begin                 | `POST /checkout-checkpoints`                        | `payments:request`  |
| Read                  | `GET /checkout-checkpoints/{id}`                    | `transactions:read` |
| Record a Link request | `POST /checkout-checkpoints/{id}/payment-reference` | `payments:execute`  |
| Confirm               | `POST /checkout-checkpoints/{id}/confirm`           | `payments:execute`  |
| Report outcome        | `POST /checkout-checkpoints/{id}/outcome`           | `payments:confirm`  |
| Cancel before confirm | `POST /checkout-checkpoints/{id}/cancel`            | `payments:execute`  |

Begin with a stable `idempotencyKey`, merchant ID, name and HTTPS checkout URL, amount in USD cents,
purpose, and a cart with line items and totals. Continue only after `APPROVED` with
`CONFIRM_BEFORE_PAYING`.

When begin returns `200` with `AWAITING_APPROVAL` and `WAIT_FOR_APPROVAL`, read the checkpoint
every few seconds until the stage changes. Continue after `APPROVED`. Stop after `DENIED`,
`CANCELLED`, or `EXPIRED`.

Confirm with the final `amountMinor`, `currency`, and, when available, the final cart and
`pageUrl`. The raw HTTP confirm refuses a changed total. Cancel the old checkpoint, begin a new one
at the final total with a new idempotency key, and confirm that one. The SDK `checkout.confirm()`
helper performs that replacement automatically. Submit payment only after `CONFIRMED` with
`PAY_THEN_REPORT_OUTCOME`.

Confirm and report outcome also accept an optional `paymentReference`, such as
`{ "provider": "LINK", "id": "lsrq_..." }` for the Link request behind a
[Stripe Link card](https://conto.finance/docs/guides/stripe-link-cards). The checkpoint keeps the first reference it receives and
returns `409` for a different one, including concurrent attachment, confirm, and outcome requests.
Retrying the same reference is safe. Conto refuses a reference that contains a card number with `400`.
On an approved Link checkpoint, Conto records a reference in a valid request even when it refuses that
confirm or outcome, so the spend stays held if the approval then lapses. A new reference sent while a confirm is still being
checked returns `409`. Read the checkpoint and send it again once the stage changes. If the checkpoint
has closed, cancel the Link request and do not pay.

After submission, report `PAID`, `NOT_PAID`, or `UNKNOWN` on the same checkpoint. An outcome sent
before `CONFIRMED` returns `409`. The exception is a checkpoint with `linkRequestOpen: true`, where
`PAID` records the payment and `UNKNOWN` keeps the spend held for the owner. `NOT_PAID` changes nothing
there, so you can still cancel. Read its status before retrying after a timeout. Never submit the
payment twice. A reported outcome has `settlementVerified: false` and is not proof of settlement.
If Conto returns `503 PAYMENTS_PAUSED`, stop checkout and ask the owner to check payment
availability. See [error handling](https://conto.finance/docs/sdk/error-handling).

## When the total changes

Tax and shipping often appear only after the buyer signs in and enters an address. The final total
still has to pass the agent's rules. If it differs from the approved total, `confirm()` replaces the
approval with one for the final total before it confirms. If the final total breaks a rule, the
payment stops there. From SDK 0.8.1, `confirm()` reads the checkpoint first when the total differs,
which needs the `transactions:read` scope that standard agent keys have. A checkpoint with a Link
request throws `LINK_CARD_TOTAL_CHANGED` instead. See
[Stripe Link cards](https://conto.finance/docs/guides/stripe-link-cards#when-the-total-changes).

If the final total needs the owner's approval, the owner gets a new request for it. `confirm()`
throws `CheckoutApprovalPendingError`:

```typescript

const final = { amountMinor: finalTotal, totals: finalTotals };
let confirmed: CheckoutCheckpoint;
try {
  confirmed = await conto.checkout.confirm(checkpoint, final);
} catch (error) {
  if (!(error instanceof CheckoutApprovalPendingError)) throw error;
  const approved = await conto.checkout.waitForApproval(error.checkpoint);
  confirmed = await conto.checkout.confirm(approved, final);
}
```

When you pass `lineItems` or `totals` to `confirm()`, Conto checks the items and the final total. A `totals` row has the form `{ type, label, amountMinor }`. Include exactly one row with `type: 'total'` that equals `amountMinor`. Other rows, such as `subtotal`, `tax` and `shipping`, may differ from the ones passed to `begin()`. A substituted item at the same total gets a 409. SDK 0.7.0 and later send these fields to Conto.

Pass `pageUrl` to `confirm()` to check that the payment is submitted on the merchant's site or the
payment method's own pages.

## Report the outcome

- `PAID` keeps the amount counted toward the agent's limits.
- `NOT_PAID` keeps it counted until the owner records what happened.
- `UNKNOWN` keeps it counted until you report `PAID` or the owner records what happened.

Report an outcome only after `confirm()` succeeds. To stop before that, cancel the checkpoint.

Checkout spend counts toward the agent's daily, weekly, and monthly limits at agent or organization
scope, together with its wallet and card spend.

An approved checkpoint that is never confirmed is released when its approval expires, 30 minutes
after `begin()` or after the owner's approval. A Link checkpoint whose Link request Conto has stays
held instead, because the Link card may still work. When a confirmed checkpoint or a held Link
checkpoint has no outcome, the owner gets an alert to check the order with the merchant.

## What the owner sees

Each checkout appears in **Transactions**, with its status, amount, payment method, agent, purpose,
order number, and steps. A checkout that waits for approval links to its request in
**Inbox**.

When a confirmed checkout has no outcome, or the agent reported `UNKNOWN`, its page shows
**Mark as paid** and **Mark as not paid**. Owners, Admins, and Managers can use them. Mark as paid
keeps the amount counted toward the agent's limits. Mark as not paid releases it.

## MCP tools

An MCP agent uses the same flow with five tools: `checkout_checkpoint_begin`,
`checkout_checkpoint_confirm`, `checkout_checkpoint_report_outcome`, `checkout_checkpoint_cancel`,
and `checkout_checkpoint_status`.

When `checkout_checkpoint_begin` returns `AWAITING_APPROVAL`, its result tells the agent not to
open the payment method. The agent calls `checkout_checkpoint_status` every few seconds until the
stage is `APPROVED`, then continues. It stops if the stage becomes `DENIED`, `CANCELLED`, or
`EXPIRED`. `checkout_checkpoint_confirm` can return `AWAITING_APPROVAL` for a changed total. The
agent waits the same way, then calls confirm again. See [MCP tools](https://conto.finance/docs/mcp/tools#checkout-checkpoints-5).

## How strong this control is

Checkpoints are the lightweight way to add Conto to a checkout. Conto decides, and your checkout
acts on the answer. Conto does not see the card or the charge, so it does not check a payment your
agent makes without calling the checkpoints, and it records the outcome you report.

With Stripe Link, the [Stripe Link card integration](https://conto.finance/docs/guides/stripe-link-cards) goes further. The
agent asks Conto before it asks Stripe Link for a card, and Stripe Link is asked only after Conto
approves the purchase.

For control at the moment of payment, pay through Conto: a
[managed wallet](https://conto.finance/docs/guides/custody-modes), or a [connected card](https://conto.finance/docs/guides/connected-cards) whose
single-use credential Conto releases only after the controls pass.

## Shared budgets

A [shared budget](https://conto.finance/docs/sdk/shared-budgets) that covers an agent counts its checkout checkpoints. `begin()` holds the amount on each budget that covers the agent, and the outcome settles or releases it. A paused or expired budget refuses them. If a budget refuses, `begin()` throws a `ContoError` with status `409`, code `POLICY_VIOLATION` and a `reasonCode` such as `SHARED_BUDGET_EXCEEDED`, and the owner's Transactions row reads **Refused by a budget**. A retry with the same key throws `CheckoutCheckpointClosedError`, so use a new key. See [checkouts and Stripe Link](https://conto.finance/docs/sdk/shared-budgets#checkouts-and-stripe-link).

Card checkouts that Conto completes for an approved cart are still refused for any agent a budget covers.

## Shared-agent accounting

Checkout checkpoints reserve against the shared agent’s counters. Period limits and BUDGET_CAP rules are rechecked while holding the agent spending lock, so concurrent customers cannot each consume the same remaining capacity. Each execution owns a unique reservation: cancelling it releases only that hold, and retrying a cancellation completes an interrupted release without releasing it twice. Finalized spend remains counted. They also count against [shared budgets](https://conto.finance/docs/sdk/shared-budgets), the ones on the Budgets page.
