# Conto with Stripe Link

> Check an agent's Link purchase against the owner's rules right before Link opens and again right before it pays.

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

Documentation group: Agentic commerce

Stripe Link is Stripe's payment wallet. Conto works with it at two points in a Link checkout:
right before Link opens, and right before your agent submits the payment. Conto checks the purchase against the owner's rules at both points. The
agent opens Link and pays only after Conto approves. Then it reports whether the payment went
through.

The SDK calls Conto's hosted policy, approval, and spending services. Your trusted runtime
runs the store checkout and enforces Conto's decision before opening Link and before paying.
The buyer pays with their own Link account. Nobody connects Link to Conto.

Start with the [Stripe Link demo](https://conto.finance/demos/claude/multi-agent), then
[add the checkpoints](#add-the-checkpoints) to your buyer runtime. The demo uses a
fictional catalog and Stripe test checkout; no personal payment details are needed.

## Try the approval flow

Open the [Agent overview](https://conto.finance/demos/claude/multi-agent) and choose
**Start agents**. All three agents belong to the same demo organization. Conto’s shared
supplier policy applies to all three; each agent also has its own budget. Office prepares a \$39 laptop stand that passes Conto, Equipment
prepares a \$349 monitor that waits for human review, and Events prepares a \$79
coffee maker that is stopped until its purchasing window opens. New sessions allow
office equipment for Office and Equipment, and home & kitchen purchases for Events.
Existing sessions keep their saved policies.

Inspect Equipment's item and total, then choose **Approve \$349.00** or **Deny**
on the Equipment agent card. The organization-wide approval queue links to that card. After approval, follow **Continue to Link →** to the review page, then
continue into Stripe's test checkout. The handoff performs the demo's final check
before opening checkout. Stop before payment; approval and opening checkout are not
payment completion.

To try a category restriction, open **More** on Office's card and choose **Try a coffee maker**. Its
office-equipment policy stops that cart. Choose **Fix policy** to open
the category control, change it, then choose **Save purchase rules** and **Retry purchase**.
The retry keeps the blocked purchase.
**More → Run again** restores the planned laptop stand.

To try a date change, choose **Fix policy** on Events' blocked purchase,
then choose **Any time** under
**Purchasing dates · UTC**, then **Save purchase rules** and **Retry purchase**. The date
restriction clears; all other controls, including approval requirements, still apply.
Each agent keeps its own budget.

The demo lets you act as the budget holder and reviewer. In your integration, only
the organization's authorized reviewers can approve. Demo limits differ from the
starter organization limits described below. Choose **Shopping chat** on an agent’s card
to browse products, change its cart, review purchase checks, and continue checkout in the
same conversation. Each agent keeps its own conversation and cart when you close the
panel and open another agent. Before an agent starts, its chat shows the planned
purchase. Use **Start purchase** or ask it to buy the item. **Edit policies** opens
the same agent policy panel as the clickable budget and approval summary on the overview. Close the panel to return to the overview.

The hosted sandbox demonstrates its own handoff boundary. For an agent that also
presses Pay, implement the second checkpoint immediately before that action.

## Manage several agents

Set [spend limits](https://conto.finance/docs/policies/spend-limits) and store restrictions for each agent, and apply
[organization policies or reusable assigned policies](https://conto.finance/docs/policies/overview#assigning-policies)
across agents. Every applicable policy must pass. Reusing a policy applies the same rules. It does not set one limit that the agents share. A [shared budget](https://conto.finance/docs/sdk/shared-budgets) does. It counts purchases made through checkout checkpoints and `checkout.getLinkCard()`, and Conto declines approval at its limit. Daily, weekly, and monthly agent or organization
limits count the agent's held and paid checkout spend alongside its wallet and card spend. See
[checkout purchases](https://conto.finance/docs/policies/evaluation#checkout-purchases) for the counting rules.

Purchases that pass every applicable rule without a review requirement continue automatically
through Conto. A human steps in when a policy requires review; Link's own authorization still applies.

Supplier allowlists and blocklists match the checkout domain, not the merchant label supplied by
the agent. See [the merchant is the checkout domain](https://conto.finance/docs/guides/checkout-checkpoints#the-merchant-is-the-checkout-domain).
For category rules, pass a `category` such as `EQUIPMENT` from trusted checkout configuration.
Conto evaluates that supplied category; it does not independently verify a merchant category code
or classify individual products. Do not let the model choose a category to bypass policy.
When omitted, a Link checkpoint uses `STRIPE_LINK` as its policy category.

For example, an agent with a $1,000 monthly budget and a $500 per-purchase limit has already
spent $800. A $450 request fits the per-purchase limit but exceeds the monthly budget, so
Conto denies it before Link opens. A review approval does not override a hard spending cap;
the budget holder must change the applicable policy before retrying an otherwise blocked purchase.

When a policy holds a checkout for review, the organization's
[approval workflow](https://conto.finance/docs/guides/approval-workflows) selects the reviewers. Configure named members
or roles, multiple approvals, ordered reviews, and expiry or escalation in **Policies → Approvers**,
through the workflow API, or with the Conto assistant. A workflow does not by itself
hold a policy-approved checkout; configure a policy to require review for the purchases you
want routed. Review requests and reported outcomes across agents in **Inbox**
and **Transactions**. Each agent's **Transactions** tab includes its wallet, card, and
checkout activity. Requests blocked before a checkout is created appear there as
**Blocked by policy**, and in **Audit logs**; no payment or hold was created for them.

### Set up the agents together

Create each agent in the dashboard and generate a separate **standard SDK key** on its
**Connect** tab. Each runtime uses its own agent's key; sharing one key makes all
those runtimes act as the same agent for policy and spending records.

Create a supplier policy with the approved checkout domains and assign that same policy
to the agents. Add separate spend and review policies for each agent. For example:

| Agent     | Monthly budget | Per-purchase cap | Human review above |
| --------- | -------------- | ---------------- | ------------------ |
| Office    | $1,000         | $200             | $100               |
| Equipment | $5,000         | $1,000           | $300               |
| Events    | $200           | $1,000           | $100               |

An events request for $600 fails its monthly budget even if it fits the per-purchase cap.
Other agents' remaining budgets do not cover that request. A longer-period budget can be
lower than a per-purchase cap; every applicable limit must pass.

Organization policies still apply. The starter organization limits below would also stop
these larger examples: the budget holder must configure the intended organization rules
as well as each agent's policies. A less restrictive agent policy never overrides a
stricter organization policy. Configure the [approval workflow](https://conto.finance/docs/guides/approval-workflows)
separately if review needs to go beyond the default owner.

## Link's own authorization

Conto policies are configured in Conto, separately from Link's account limits and any approval
Link requires. Depending on the supported agent and checkout, Link approval can happen in
[agent chat](https://stripe.com/newsroom/news/stripe-helps-meta-muse-shop-with-link), at
[merchant checkout](https://docs.stripe.com/payments/link), or through Link's website or app.
Conto does not bypass those requirements or set Link's limits.

## Add the checkpoints

You need access to the buyer's checkout runtime, an agent and its standard SDK key,
and a supported Link checkout. Create the agent in the dashboard, then choose
**Generate SDK key** on its **Connect** tab. Keep the key in server-side
configuration, outside model input and browser code. Creating a Conto account does not
connect or modify your existing checkout automatically.

Use SDK 0.7.0 or later for final-cart forwarding. Checkpoints currently support USD;
`amountMinor` and item prices are integer cents.

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

For a copy-and-run starting point, download the
[Link controls starter](https://conto.finance/examples/conto-link-controls-0.8.1.zip).
Unzip it, open the `conto-link-controls` folder, and run `npm ci --ignore-scripts`.
Follow its README to configure your test agent and Link sign-in. It includes `npm run doctor` for local setup checks and a test-card verification that
cancels the unused Link card and then the checkpoint, so nothing stays held. Its README walks through allowed,
review-required, and blocked purchases. It never opens a merchant checkout or pays.

```typescript

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

// 1. Right before Link opens.
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',
  category: 'EQUIPMENT', // From trusted checkout configuration, not model-selected authority.
  lineItems: [{ name: 'USB-C phone charger', quantity: 1, unitAmountMinor: 1500 }],
});

if (checkpoint.stage === 'AWAITING_APPROVAL') {
  // Required reviewers must approve first. Do not open Link yet.
  checkpoint = await conto.checkout.waitForApproval(checkpoint);
}
if (checkpoint.stage !== 'APPROVED') {
  throw new Error('Inspect the existing purchase before continuing.');
}

// Your adapter opens Link; the buyer completes any Link authorization.
await checkout.openLink();

// 2. Right before payment, reread the actual cart on every attempt.
let confirmed;
let finalCart;
for (let attempt = 0; attempt < 3; attempt += 1) {
  finalCart = await checkout.readFinalCart();
  // Includes amountMinor, currency, lineItems, totals and pageUrl.
  try {
    confirmed = await conto.checkout.confirm(checkpoint, finalCart);
    break;
  } catch (error) {
    if (!(error instanceof CheckoutApprovalPendingError)) throw error;
    checkpoint = await conto.checkout.waitForApproval(error.checkpoint);
    // Reobserve after review; never reuse the pre-review cart.
  }
}
if (confirmed?.stage !== 'CONFIRMED') {
  throw new Error('Stop and review the changing checkout before paying.');
}

// Your trusted executor must recheck finalCart and atomically claim dispatch
// for this purchase before submitting once. Confirmation is not a dispatch lock.

const { outcome, reference } = await checkout.submitOnce({
  purchaseId: order.id,
  checkpoint: confirmed,
  finalCart,
});

// 3. Report the observed result, not an assumed success.
await conto.checkout.reportOutcome(confirmed.id, { outcome, reference });
```

The example assumes your runtime supplies `order`, `page`, and a trusted `checkout`
adapter. `openLink()` opens the supported Link UI; `readFinalCart()` independently
reads all final items and charges. `submitOnce()` must recheck the cart, claim dispatch
atomically for the original purchase ID, submit once, and durably save the observed
outcome and non-sensitive reference before returning them. Use `UNKNOWN` for ambiguous
submission; only return `PAID` with purchase evidence. If reporting fails, retry from
the saved outcome without submitting again. The SDK does not operate the browser or
provide these adapter methods. The $15 charger is illustrative purchase data, not an
item in the public demo catalog.

If `begin()` or `confirm()` throws, stop the checkout and do not pay. Read the actual final items and charges
in your trusted checkout code and pass them to `confirm()`. A same-price item substitution
also requires fresh authorization. The [Link card guide](https://conto.finance/docs/guides/stripe-link-cards#when-the-total-changes)
explains the SDK version requirement for final-cart forwarding and payment retry handling.

`checkoutMethod` defaults to `LINK`, so a Link checkout can leave it out. `checkoutUrl` is the
store's checkout page. Conto names the merchant by its domain. See
[the merchant is the checkout domain](https://conto.finance/docs/guides/checkout-checkpoints#the-merchant-is-the-checkout-domain).

Reuse the same `idempotencyKey` when you retry `begin()`. If you know the checkpoint ID after a timeout, read it with
`conto.checkout.get(id)` before continuing. If the first `begin()` response never arrived,
retry `begin()` with the same key to recover the same checkpoint. Your executor must
claim payment dispatch once per purchase: a replayed confirmation is not permission to
submit payment twice. If outcome reporting fails after payment, reconcile and retry the
report; do not submit payment again.

[Checkout checkpoints](https://conto.finance/docs/guides/checkout-checkpoints) covers every stage, the HTTP endpoints, and
the MCP tools.

Download the [checkpoint example](https://conto.finance/examples/stripe-link-checkpoints.mjs)
and import `prepareLinkPayment` into your trusted runtime. Pass the same `conto`,
`purchase` (the input to `begin()`), and `checkout` adapter shown above. The function
uses `openLink()` and `readFinalCart()` and returns `{ checkpoint, finalCart }` for
your executor's `submitOnce()` step.

The example's authorization, approval, changed-total and denial paths were exercised
through the customer chat with synthetic policy and Link services. The changed-total
case observed $18, then $19 during review, and reread $19 before confirming; Link
opened once. This is not live payment or settlement proof.

It returns the confirmed cart to your executor; it does not supply a universal
browser driver, submit payment, or verify settlement. Preserve the checkpoint when
review times out or the cart keeps changing so you can resume or cancel the unused
hold. Do not restart an uncertain payment.

## When the owner must approve

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

When a rule requires approval, `begin()` returns the stage `AWAITING_APPROVAL`. Conto holds the $15
against the agent's limits and routes the request through the organization's approval workflow.
The default review goes to the owner; configured workflows can require other reviewers or several
approvals. Do not open Link while the checkpoint waits.

`waitForApproval()` returns the checkpoint once all required approvals are complete. The agent then
has 30 minutes to confirm. If a reviewer rejects the purchase or the request expires,
`waitForApproval()` throws and Conto releases the spend. See
[when the owner must approve](https://conto.finance/docs/guides/checkout-checkpoints#when-the-owner-must-approve).

### Resume a held or changed purchase

`waitForApproval()` polls for up to 10 minutes by default. A
`CheckoutApprovalTimeoutError` stops polling but leaves the purchase and spending hold
in place. Wait again using the error's checkpoint, or cancel the checkpoint if the buyer
abandons the purchase. A reviewer rejection or an expired request closes it and releases
the hold; a polling timeout is not an expiry.

When the final total changes, `confirm()` cancels the old authorization and checks a new
checkpoint at that total. If it needs review, the SDK throws
`CheckoutApprovalPendingError` with the new checkpoint. Wait for its required approvals,
read the actual final cart again, and confirm the returned checkpoint before paying.
A same-price substitution also needs a new authorization: cancel the unused checkpoint
and begin a new purchase with the changed items and a new idempotency key.

For Link-issued cards, use the [card guide](https://conto.finance/docs/guides/stripe-link-cards#when-the-total-changes):
the existing card remains limited to its authorized amount and must not be reused for a
different purchase.

## Test without a live purchase

The [commerce demo](https://conto.finance/demos/claude/multi-agent) supplies a fictional catalog
and a Stripe-hosted checkout in Stripe test mode. Choose **Start agents** to compare
an allowed purchase, a purchase awaiting human review, and a date-blocked request
in one view. Edit budgets and review purchases beside each agent. Use **Shopping chat** on an agent’s card
to change its cart. Stop before payment to inspect the controls without completing
even a test order.

For your own hosted checkout, use a Stripe test checkout supplied by the merchant's test
environment. A Conto checkpoint does not turn a live merchant page into a sandbox. If you
do not have a supported test environment, inspect the Conto decision and stop before
opening or submitting a live payment.

If your agent requests a card through Link CLI, use
[`linkCliWallet({ test: true })`](https://conto.finance/docs/guides/stripe-link-cards#test-mode).
That is a separate test-card path, not a setting on the checkpoint client or a way to
switch an arbitrary merchant checkout into test mode. Conto still records the test
requests and counts their holds against the configured agent's limits; use dedicated
test agents. Never report `PAID` when you stopped before payment.

## Report the outcome

After the agent submits the payment, it reports one outcome on the confirmed checkpoint:

- `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 the agent reports `PAID` or the owner records what happened.

Report an outcome only after `confirm()` succeeds. To stop before that, cancel the checkpoint with
`conto.checkout.cancel()`. If a Link card was requested for it, cancel the Link request first with
`wallet.cancel()`, because the checkpoint cancel releases the spend even if the card still works. A
checkpoint with `linkRequestOpen: true` can also report an outcome. See
[Stripe Link cards for agents](https://conto.finance/docs/guides/stripe-link-cards).

A not paid decision does not close a Link card, which can work for up to 48 hours. Cancel the Link
request before you start a new purchase.

## What the owner sees

- **Approvals.** A purchase that needs approval appears in **Inbox** with the
  merchant, the checkout site, the payment method, the items, the purpose, and the agent. The owner
  or configured reviewer chooses **Approve** or **Reject**. A workflow with
  several required approvals must complete before the checkout continues.
- **Transactions.** Each checkout appears in **Transactions**. Its page shows the status, the
  amount, the agent, the order number, and each step.
- **Missing outcomes.** When a confirmed checkout has no outcome, the owner gets an alert. After
  checking the order with the merchant, an Owner, Admin, or Manager chooses **Mark as paid** or
  **Mark as not paid** on the checkout page.

## Ask Conto before Stripe Link issues a card

With the [Stripe Link card integration](https://conto.finance/docs/guides/stripe-link-cards), the agent asks Conto before it
asks Stripe Link for a card. Stripe Link is asked only after Conto approves the purchase, for
exactly the approved amount at that store. Any approval Link requires still applies, and Conto does not receive
the card number. Use it when the agent fills in a store's card form with a Link card.

## Stronger control with connected cards

Checkpoints rely on your agent's checkout to call Conto and follow the answer. Conto does not see
the Link payment, so it records the outcome your checkout reports.

For control at the moment of payment, use a [connected card](https://conto.finance/docs/guides/connected-cards). Conto
releases a single-use card credential only after the owner's controls pass. Connecting a card to
Conto does not connect a Link account.
