Developers · Commerce Execution
Your AI's shopping account
Connect once. Shop through any AI. Your agent keeps the conversation; Ottr completes the purchase and returns a verified order.
Overview
Ottr is the commerce execution layer for AI agents. Your agent understands what the customer wants and finds the product. It sends Ottr a structured purchase request. Ottr checks the merchant and the product, prices the checkout, and returns a link for the customer to approve on Ottr. Once they approve, Ottr pays and checks out through the merchant's API or Ottr's browser execution engine, verifies the order and reports back.
- Consumer-linked: assistants such as ChatGPT and Claude connect the customer's Ottr account with OAuth. The access token identifies both the assistant and the customer.
- Developer-managed: your product uses an Ottr API key; each customer issues your agent a customer reference (or links with OAuth).
Both use the same engine and the same guarantees: your agent never sees card details, and only the customer can approve a purchase.
Quick start
- Sign in to Ottr and open Connect an AI agent: it creates your agent's API key and connects it to your account, with instructions to paste into the agent. (Or register an OAuth client.)
- Find the product on any retailer's own website. Ottr buys by product link: retailers it has not seen before are set up automatically while the purchase is prepared.
POST /v1/commerce/purchaseswith a structured request. You get202and apurchase_id.- When the status is
AWAITING_CUSTOMER_APPROVAL, show the customerapproval.url. - Follow the status (poll or webhooks) to
COMPLETEDand read the order.
curl -X POST https://ottr.si/v1/commerce/purchases \
-H "Authorization: Bearer $OTTR_KEY" \
-H "OTTR-Customer-Ref: $CUSTOMER_REF" \
-H "Idempotency-Key: 7d1c6c1e" \
-H "Content-Type: application/json" \
-d '{ "request_id": "REQ-10281", "merchant": "ottr-test-merchant", "product": { "id": "HP-SONY-XM5", "quantity": 1 }, "purchase_constraints": { "maximum_total_amount": 300, "currency": "GBP", "delivery_country": "GB", "allow_substitutions": false }, "execution_preference": "auto" }'Authentication
API key. Send Authorization: Bearer ottr_ak_.... Calls that act for a customer also need OTTR-Customer-Ref: ottr_cr_..., which the customer issues to your agent from their Ottr Security page.
OAuth 2.1 (account linking). Metadata: https://ottr.si/.well-known/oauth-authorization-server and https://ottr.si/.well-known/oauth-protected-resource. Register a client at /oauth/register (RFC 7591), send the customer to /oauth/authorize with PKCE (S256, required), and exchange the code at /oauth/token. Access tokens last one hour; refresh tokens rotate on use, and presenting an old one ends the link.
commerce.readSee supported retailers and your purchase statuscommerce.checkout.preparePrepare checkouts with retailerscommerce.purchase.requestAsk you to approve purchasescommerce.orders.readSee your orderscommerce.orders.cancelCancel purchases and orders where possibleLimits apply per agent organisation (requests per minute and purchases in progress). A 429 carries Retry-After.
Purchase requests
{
"request_id": "REQ-10281",
"merchant": "ottr-test-merchant",
"product": { "id": "HP-SONY-XM5", "quantity": 1 },
"purchase_constraints": {
"maximum_total_amount": 300,
"currency": "GBP",
"delivery_country": "GB",
"allow_substitutions": false
},
"execution_preference": "auto"
}product: an exacturlon the merchant's own website, a merchantid, or aname; plussize,colour, othervariantoptions andquantity(1 to 5).purchase_constraints.maximum_total_amountis in major units (150 means £150) and covers items and delivery. Above it, the purchase stops withPRICE_CHANGED.delivery.address_refandpayment.payment_method_refmust belong to the customer; by default Ottr uses their defaults.- Any retailer's public https product page works (apart from retailers Ottr has blocklisted). A retailer Ottr has not seen before is registered on the spot, and its first quote discovers its checkout; that takes a little longer. Check first with
POST /v1/commerce/merchants/check. Ottr never opens private or internal addresses. - Repeating a
request_idreturns the same purchase.Idempotency-Keyreplays the original response for 24 hours.
Customer approval
{
"purchase_id": "pur_...",
"status": "AWAITING_CUSTOMER_APPROVAL",
"approval": {
"type": "hosted_authorisation",
"url": "https://ottr.si/approve/...",
"expires_in_seconds": 900
},
"order_summary": { "merchant": "...", "product": "...", "total": { "amount": 125, "currency": "GBP" } }
}Show the link to the customer. They sign in to Ottr and approve the exact merchant, product, quantity, delivery address and total. If any of those changes, a new approval is needed. GET /v1/commerce/purchases/{id}/approval returns a fresh link if the old one expired. No API call can approve on the customer's behalf: execute checks Ottr's own record of the customer's approval.
Status and lifecycle
CREATEDsubmittedRequest accepted.VALIDATINGworkingChecking the product with the merchant.PRODUCT_VERIFIEDworkingProduct, option and price verified.CHECKOUT_PREPARINGworkingCreating the checkout.AWAITING_CUSTOMER_APPROVALauth-requiredShow the approval link to the customer.APPROVEDworkingThe customer approved on Ottr.PAYMENT_PREPARINGworkingTaking the customer's payment and preparing the card.ORDER_SUBMITTINGworkingChecking out with the merchant.ORDER_CONFIRMEDworkingThe merchant confirmed the order.COMPLETEDcompletedDone; the order and its reference are available.PRODUCT_UNAVAILABLEfailedOut of stock, or the option is unavailable.PRICE_CHANGEDfailedAbove the maximum, or the price changed. Prepare again.CUSTOMER_ACTION_REQUIREDinput-requiredThe customer must finish setting up Ottr (link provided).AUTHENTICATION_REQUIREDauth-requiredThe customer's bank asked for authentication (3-D Secure).PAYMENT_FAILEDfailedThe customer's payment was declined.ORDER_OUTCOME_UNKNOWNworkingConfirming with the merchant. Never retried until the outcome is known.FAILEDfailedNot completed; any payment is refunded.CANCELLEDcanceledCancelled; nothing charged.EXPIREDcanceledThe customer did not approve in time.The second column is the A2A task state. A purchase is only confirmed when the merchant has accepted the order (its API, or its confirmation page with an order reference); payment authorisation alone is not enough. When Ottr cannot tell whether an order was placed, the status is ORDER_OUTCOME_UNKNOWN and nothing is retried until the outcome is established.
Webhooks
Register an https endpoint with POST /v1/commerce/webhooks ({ "url": "...", "events": [] }, empty for all). Ottr immediately sends a signed webhook.verification event; answer 2xx with the challenge value in the body. The signing secret is returned once.
Events: commerce.purchase.created, commerce.purchase.checkout_prepared, commerce.purchase.approval_required, commerce.purchase.approved, commerce.purchase.authentication_required, commerce.purchase.payment_processing, commerce.purchase.order_confirmed, commerce.purchase.completed, commerce.purchase.failed, commerce.purchase.cancelled, commerce.purchase.outcome_unknown. Each carries the event id, type, timestamp, agent id, purchase id, status and non-sensitive data. Failed deliveries are retried with backoff for about an hour.
// Node.js: verify Ottr-Signature: t=<unix>,v1=<hex>
import { createHmac, timingSafeEqual } from 'node:crypto';
export function verify(secret: string, rawBody: string, header: string) {
const m = header.match(/t=(\d+),v1=([0-9a-f]{64})/);
if (!m || Math.abs(Date.now() / 1000 - Number(m[1])) > 300) return false;
const want = createHmac('sha256', secret).update(`${m[1]}.${rawBody}`).digest('hex');
return timingSafeEqual(Buffer.from(want), Buffer.from(m[2]));
}# Python
import hmac, hashlib, re, time
def verify(secret: str, raw_body: bytes, header: str) -> bool:
m = re.match(r"t=(\d+),v1=([0-9a-f]{64})", header)
if not m or abs(time.time() - int(m.group(1))) > 300:
return False
want = hmac.new(secret.encode(), m.group(1).encode() + b"." + raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(want, m.group(2))MCP (Claude, ChatGPT and other clients)
Endpoint: https://ottr.si/api/mcp (Streamable HTTP). Tools: check_merchant_support, prepare_purchase, get_checkout_quote, get_purchase_status, get_purchase_approval, execute_approved_purchase, get_order_confirmation, get_order_history, cancel_purchase.
Claude: Settings, Connectors, Add custom connector, and enter the endpoint URL. Claude registers itself and asks the customer to sign in to Ottr and connect. ChatGPT: add Ottr as a connector (custom MCP server) with the same URL; ChatGPT handles the OAuth sign-in the same way.
Clients that use an API key instead:
{
"mcpServers": {
"ottr": {
"url": "https://ottr.si/api/mcp",
"headers": { "Authorization": "Bearer ottr_ak_...", "OTTR-Customer-Ref": "ottr_cr_..." }
}
}
}A2A
Agent card: /.well-known/agent-card.json. Skills prepare_purchase, execute_purchase and track_purchase take the same JSON as the REST API. A purchase is a task (tsk_pur_...) whose state follows the lifecycle: auth-required while the customer approves, working through checkout, then completed, failed or canceled. Use GetTask to follow it and CancelTask to cancel where possible.
POST https://ottr.si/api/a2a
{ "jsonrpc": "2.0", "id": 1, "method": "SendMessage",
"params": { "message": { "messageId": "m1", "role": "user",
"parts": [{ "data": { "skill": "prepare_purchase", "request_id": "REQ-10281", "merchant": "ottr-test-merchant", "product": { "id": "HP-SONY-XM5", "quantity": 1 }, "purchase_constraints": { "maximum_total_amount": 300, "currency": "GBP", "delivery_country": "GB", "allow_substitutions": false }, "execution_preference": "auto" } }] } } }Code examples
// TypeScript (Node 18+)
const base = 'https://ottr.si/v1/commerce';
const headers = { authorization: `Bearer ${process.env.OTTR_KEY}`, 'ottr-customer-ref': process.env.CUSTOMER_REF!, 'content-type': 'application/json' };
const res = await fetch(`${base}/purchases`, { method: 'POST', headers: { ...headers, 'idempotency-key': crypto.randomUUID() }, body: JSON.stringify({
"request_id": "REQ-10281",
"merchant": "ottr-test-merchant",
"product": { "id": "HP-SONY-XM5", "quantity": 1 },
"purchase_constraints": {
"maximum_total_amount": 300,
"currency": "GBP",
"delivery_country": "GB",
"allow_substitutions": false
},
"execution_preference": "auto"
}) });
let p = await res.json();
while (['CREATED', 'VALIDATING', 'PRODUCT_VERIFIED', 'CHECKOUT_PREPARING'].includes(p.status)) {
await new Promise((r) => setTimeout(r, 2000));
p = await (await fetch(`${base}/purchases/${p.purchase_id}`, { headers })).json();
}
if (p.status === 'AWAITING_CUSTOMER_APPROVAL') console.log('Ask the customer to approve:', p.approval.url);# Python (requests)
import os, time, uuid, requests
base = "https://ottr.si/v1/commerce"
headers = {"Authorization": f"Bearer {os.environ['OTTR_KEY']}", "OTTR-Customer-Ref": os.environ["CUSTOMER_REF"]}
body = {
"request_id": "REQ-10281",
"merchant": "ottr-test-merchant",
"product": { "id": "HP-SONY-XM5", "quantity": 1 },
"purchase_constraints": {
"maximum_total_amount": 300,
"currency": "GBP",
"delivery_country": "GB",
"allow_substitutions": False
},
"execution_preference": "auto"
}
p = requests.post(f"{base}/purchases", json=body, headers={**headers, "Idempotency-Key": str(uuid.uuid4())}).json()
while p["status"] in ("CREATED", "VALIDATING", "PRODUCT_VERIFIED", "CHECKOUT_PREPARING"):
time.sleep(2)
p = requests.get(f"{base}/purchases/{p['purchase_id']}", headers=headers).json()
if p["status"] == "AWAITING_CUSTOMER_APPROVAL":
print("Ask the customer to approve:", p["approval"]["url"])Errors
Errors are JSON: { "code": "...", "message": "..." }. Common codes: invalid_request (400), unauthorised and customer_required (401), customer_permission and scope (403), not_found (404), approval_required, request_id_conflict and not_cancellable (409), merchant_not_supported, product_url_mismatch and idempotency_conflict (422), rate_limited and concurrency_limit (429), commerce_disabled and busy (503).
Sandbox
Merchant ottr-test-merchant is Ottr's test shop: nothing real is bought or charged. Use a product id such as HP-SONY-XM5, HP-BOSE-QCU, HP-BOSE-QC45, HP-SENN-M4, or its shop page https://ottr.si/sandbox-merchant/store/HP-SONY-XM5 to exercise browser checkout. The same page with ?layout=alt has an unfamiliar layout for AI-assisted navigation.
Status explorer
Look up a purchase with your key. The key is sent only to Ottr and is not stored.