Checkout flow
POST /v1/quotes (one per item) ─▶ qt_ (price locked 15 min)
POST /v1/checkouts { items } ─▶ chk_ pending_payment ──(user pays once on Stripe)──▶ paid ─▶ placing ─▶ confirmed
│ ├─▶ partially_confirmed (failed items refunded)
├─▶ expired (link expired / session expired) └─▶ failed ─▶ refunded
└─▶ cancelled (agent cancelled before payment)
At a glance
Who talks to whom, from the first catalog call to the receipt, and the states a checkout moves through. The same charts, with the order lifecycle and the support flow, are on the Workflows page.
sequenceDiagram
autonumber
participant A as Agent
participant S as agents.snappy.com
participant U as Shopper
participant ST as Stripe
participant Q as Cloud Tasks
participant SN as Snappy API
A->>S: GET /v1/search, /v1/products/:id, /v1/variants/:id/availability
S->>SN: products, variants, live availability per country
S-->>A: all-in price per country (item + shipping + duties + service fee)
A->>S: POST /v1/quotes (variantId) once per cart line
S-->>A: qt_ with the price locked for 15 min
A->>S: POST /v1/checkouts (quotes, recipient, address, notify, smsConsent, callbackUrl)
S->>SN: validate the address for physical items
S->>ST: create one Checkout Session, one line per item, expires with the checkout (30 min)
S-->>A: chk_ pending_payment with paymentUrl, statusUrl, eventsUrl, nextStep
A->>U: hand over paymentUrl, never ask for card details
U->>ST: pays on the hosted Stripe page
ST->>S: POST /webhooks/stripe checkout.session.completed (signature verified, deduped by event id)
S->>S: paid amount and currency must match the quote, otherwise failed and refunded
S->>Q: enqueue place-order, dedupe key place-chk_
Q->>S: POST /internal/tasks/place-order with an OIDC token
loop One Snappy order per item
S->>SN: POST /v3/orders with idempotencyKey chk_:index
SN-->>S: order id and tracking link, or a 4xx rejection for that item
end
S->>S: confirmed, partially_confirmed (rejected items refunded) or failed (refunded in full)
S->>Q: enqueue notify-purchase-confirmed and agent-callback when callbackUrl is set
par Poll or stream
A->>S: GET /v1/checkouts/:id or GET /v1/checkouts/:id/events (SSE, Last-Event-ID resumes)
S-->>A: status, items with orderIds, nextStep
and Signed callback
S->>A: POST callbackUrl with X-Snappy-Agents-Timestamp and X-Snappy-Agents-Signature
end
S-->>U: receipt by email (SendGrid) and by SMS (Twilio, only with consent on file)
stateDiagram-v2 [*] --> pending_payment: POST /v1/checkouts, Stripe session created pending_payment --> paid: checkout.session.completed, amount and currency match pending_payment --> failed: payment amount or currency mismatch pending_payment --> expired: 30 min passed or checkout.session.expired pending_payment --> cancelled: POST /v1/checkouts/:id/cancel expired --> paid: payment completed after the checkout had expired paid --> placing: place-order task starts placing --> placing: retryable Snappy error, task retried with the same idempotency keys placing --> confirmed: every item placed at Snappy placing --> partially_confirmed: some items rejected by Snappy, their amount refunded placing --> failed: no item could be placed failed --> refunded: refund-checkout task, full refund on the original payment confirmed --> [*] partially_confirmed --> [*] refunded --> [*] expired --> [*] cancelled --> [*]
Quote
POST /v1/quotes { variantId, countryCode? } calls Snappy's live availability for the country (US today) and computes:
item + shipping + duties (Snappy, per country) + service fee (admin setting, default 0) = totalAmount
Quotes expire after 15 minutes. A checkout against an expired quote returns 409 quote_expired; create a new quote and tell the user if the price changed.
Checkout (cart)
POST /v1/checkouts takes items: [{ quoteId, quantity? }] (up to 20 lines, quantity 1-10 each, all quotes for the same country) and validates everything that can be validated before money moves: quote freshness and ownership, address completeness and Snappy verification for physical items, country consistency, E.164 phone, SMS consent, user status, maintenance mode. Only then it creates one Stripe Checkout Session with one line per item and returns paymentUrl.
Request fields:
| Field | Notes |
|---|---|
items[] |
Quotes to buy; quantity expands into that many Snappy orders of the same variant |
recipient |
Who receives the package (buyer or someone else). phone is used by carriers. |
shippingAddress |
Full address when any item is physical; { countryCode } only for digital-only carts |
notify.email, notify.sms |
Where to send confirmation and receipt. Email defaults to the buyer; null disables. SMS requires consent (below). |
smsConsent |
true only after the user agreed to the consent text; recorded with timestamp, source and client |
callbackUrl |
Optional HTTPS endpoint for signed status pushes. It must be a public hostname (callback_url_invalid otherwise); it is resolved again before every POST and refused if it points at a private address, and redirects are not followed |
idempotencyKey |
Optional; returns the existing open checkout for the same cart |
Payment
The user opens paymentUrl (Stripe Checkout). The link expires with the checkout (30 minutes). Stripe calls /webhooks/stripe; checkout.session.completed with payment_status=paid moves the checkout to paid and enqueues order placement. The paid amount and currency are checked against the quote; a mismatch is refunded automatically and never placed.
Placement
The place-order task calls POST /v3/orders once per item with idempotencyKey = <checkout id>:<item index>, so retries after a crash or a 5xx cannot double-order. Each placed item becomes an ord_ row. When every item is placed the checkout is confirmed; when some items are definitively rejected by Snappy (4xx such as out of stock) the checkout is partially_confirmed, the rejected items' amounts are refunded automatically and the confirmation email says which ones; when nothing could be placed the checkout is failed and refunded in full. Operators see every failure on the dashboard.
Protocol checkouts (ACP, UCP)
A purchase that starts on ChatGPT, Google AI Mode or Shopify's agents does not go through quotes and the hosted Stripe page. The platform builds a protocol checkout session (pcs_…) with variant ids, buyer and address; Snappy prices it live with the same availability call and fee rule as a quote. On complete the platform hands over a scoped payment token, Snappy charges it with a PaymentIntent, creates the guest user and the quotes, and runs the same place-order logic synchronously: the session becomes a chk_… checkout that enters this state machine at paid and ends confirmed, partially_confirmed (rejected items refunded) or failed → refunded. From there everything above applies (orders, tracking, cancellation, support, receipts), and the platform is told about every change by a signed order webhook instead of callbackUrl. The protocol shapes, headers and error contract are on Agentic commerce.
Watching the result
| Method | Use |
|---|---|
GET /v1/checkouts/{id} |
Poll; nextStep tells the agent what to say |
GET /v1/checkouts/{id}/events |
SSE; replays history, resumes with Last-Event-ID, ends with event: done |
GET /v1/checkouts/{id}/timeline |
Full event list |
callbackUrl |
Signed POST on checkout.confirmed / checkout.partially_confirmed / checkout.failed with the list of orders |
Callback signature
X-Snappy-Agents-Timestamp: 1733942400
X-Snappy-Agents-Signature: sha256=HMAC_SHA256(secret, timestamp + "." + body)
The secret is provided to the agent platform out of band at onboarding.
After the purchase
GET /v1/orders/{id}returnsstage(confirmed → processing → shipped → out_for_delivery → delivered, orcancelled/refunded), tracking, andnextActions(cancel,request_support,track). Snappy webhooks keep it current;?refresh=trueforces a pull.POST /v1/checkouts/{id}/receiptre-sends the receipt for the whole purchase;POST /v1/orders/{id}/receiptfor one item. SMS to a number without consent on file needssmsConsent: true.POST /v1/orders/{id}/cancelcancels that item at Snappy and refunds its amount whilecancellableis true. Once fulfilment started, the errororder_not_cancellablecarriesnextAction: request_support.
Support requests (returns, damaged, wrong item, not received)
POST /v1/orders/{id}/support-requests { type, summary, details?, preferredResolution?, contactEmail?, contactPhone? } opens a structured request. Snappy support is emailed with the full context, the user receives an acknowledgement, and operators resolve it in the admin portal: partial or full refund (issued on the original payment), replacement, or rejection, each with a note that is emailed to the user. The agent can list requests with GET /v1/orders/{id}/support-requests or GET /v1/support-requests. One open request per order.
SMS consent
Texting a US number requires prior express consent (TCPA/CTIA). The platform records who consented, when, through which agent and to which text; the first message carries "Reply STOP to opt out"; inbound STOP/START/HELP are handled on /webhooks/twilio and opted-out numbers are never texted again (sms_opted_out). Sender identity is a Twilio Messaging Service registered for A2P 10DLC (configured in Integrations).