@conto_finance/sdk release that includes admin.purchasing.purchases. Amounts are positive integers in minor units with an uppercase currency: { amountMinor: 1200, currency: 'USD' } is $12.00. Purchases support USD only.
Credentials
Neither key can add a card, grant permission to shop or approve a purchase. Those happen on the buyer’s Conto page. An agent key also cannot create buyers or see another buyer’s purchases. A buyer’s card is paid only through purchases:
conto.connectedCards.list() leaves it out and draw() refuses it.
Set up a buyer
Map one of your users to a buyer and send the buyer to the hosted setup page.admin.purchasing.delegations.list(buyer.id). The buyer or your platform can revoke it.
A delegation covers one card and the buyer’s limits. When the buyer changes their limits, the delegation is revoked and the buyer grants it again. Each purchase is still authorized for one merchant and one total, reviewed by the buyer and verified by the card.
Start and follow a purchase
payment, Conto uses the buyer’s one delegation for this kind of store: a test card for a Conto test store, a live card otherwise. When the buyer has more than one, pass payment: { methodId, delegationId } from admin.purchasing.delegations.list(buyer.id).
create() returns at once. Reusing the idempotency key with the same input returns the same purchase, so it is safe to retry after a lost response. A different input with the same key is refused with IDEMPOTENCY_CONFLICT.
maxCost is the most the delivered order may cost. It narrows the delegation and never widens it. When you know the exact product, pass request.items with each URL, title, quantity and options.
watch() yields every event in version order until the purchase ends. It streams server-sent events, reconnects from the last version, drops a duplicate after a reconnect, and falls back to polling where streaming is unavailable. Closing your process does not stop the purchase. Start watch() again with { after: lastVersion } to resume.
From an agent’s own key
An agent that calls Conto itself, for example through the MCP server, uses its own SDK key. The purchase methods are the same:admin.agents.createSdkKey(buyer.agentId, { name: 'Purchasing agent' }). It reaches that buyer’s purchases only.
Status, phase and evidence
version increases by one with every visible change. paymentEvidence reports what is known about card authorization, the merchant’s confirmation and settlement separately. Evidence that is missing is unknown, never a guess. Settlement is always unknown here: the card provider reports issuance only.
Actions
Whenstatus is awaiting_action, requiredAction says what is needed and who completes it.
Answer
buyer_details with the fields the action lists for its form:
RESPONSE_CONFLICT. An expired or replaced action is refused with ACTION_EXPIRED or ACTION_NOT_OPEN.
For the buyer’s actions, create a single-use link on your server and send the buyer there:
requiredAction.url points at the same Conto page. It opens only for a buyer who entered through a link your platform created, so it is safe to show.
Events and webhooks
A cursor ahead of the purchase returns
CURSOR_INVALID. watch() handles it by yielding a purchase.resync event with the current purchase.
Webhooks go to your organization’s webhook URL with the event type in X-Conto-Event and the event id in X-Conto-Delivery-Id. The id is the same on every retry, so deduplicate on it. Verify each delivery with the raw body:
Cancel
cancellationOutcome is cancelled or requested. Once payment may have been submitted it is too_late and the purchase stays in reconciliation until its outcome is known. Cancelling never refunds or reverses a payment.
Errors
Refusals carry a stablecode, a requestId and whether retrying the same request can succeed later.
Test purchases
Test mode is open to every organization. Create a setup link withenvironment: 'test'. The buyer adds a test card instead of a real one. A test card pays only Conto’s test stores and a live card never does:
A test purchase runs the same limits, policies, reviews and actions as a live one, and its authorization is recorded as simulated. No card network, card provider or store is involved, and nothing is charged.