The store's assistant and the operations assistant, use case by use case
Every scene a shopper or a store operator can play out with the two first-party assistants in this reference, and what runs underneath each one.
This reference implements Anthropic's Claude Commerce Agents blueprint for merchants that run on a payment processor. Each demo merchant gets the blueprint's two agents: the store's assistant, which talks to shoppers inside the storefront, and the operations assistant, which staff use in the merchant portal. The processor sits behind both: the store's assistant hands checkout to it and shows its tender figures; the operations assistant reads its settlements, authorization rates and disputes. Nothing in either conversation charges a card or moves money.
Five fictional merchants show the two assistants, one per processor. Every company, product and person named below is invented.
| Merchant | Vertical | Processor | Merchant API | Storefront | Portal |
|---|---|---|---|---|---|
| Northstar Outfitters | outdoor retail | Clover | :8010 | :3010 | :3110 |
| Lumen Home | home retail | Stripe | :8016 | :3016 | :3116 |
| Aurora Escapes | travel | Adyen | :8017 | :3017 | :3117 |
| Beacon Wireless | telecom | Worldpay | :8018 | :3018 | :3118 |
| Encore Seats | ticketing | CyberSource | :8019 | :3019 | :3119 |
The two retail merchants use the web apps in this repository (web/storefront, web/portal), forks of the blueprint's retail apps that read their name, colors and processor from /api/brand. The other three run the blueprint's own travel, telecom and entertainment apps unchanged, pointed at the reference API, so the page chrome is the blueprint's while the assistant's name and the checkout label are the merchant's.
Starting a merchant
python scripts/run_demo.py lumen --all
The merchant keys are northstar, lumen, aurora, beacon and encore; --all starts the API with both web apps, --merchant the portal only, --api-only neither. Each platform folder wraps the same script and loads that folder's .env first, for example platforms/stripe/first-party/run.sh. Chat turns need ANTHROPIC_API_KEY; browsing, the checkout pages and the portal widgets do not.
A processor goes live when its variables are set (STRIPE_SECRET_KEY for Lumen Home; ADYEN_API_KEY and ADYEN_MERCHANT_ACCOUNT for Aurora Escapes); otherwise the merchant runs on the simulated gateway in psp_commerce/adapters/mock.py and GET /api/brand reports gateway_mode: simulated. Stripe was run live on 6 September 2026 and Adyen on 7 September 2026, against their test environments; Worldpay, CyberSource and Clover were not run live in this repository.
Search and discovery
A shopper opens Northstar Outfitters and types a starter: "Hiking boots in a 10, and are they waterproof?" The assistant answers with a sentence, a carousel of boots, and chips such as "See the size chart".
Underneath, the assistant called the blueprint's search_products with a query in the catalog's vocabulary and filters for price and rating limits, a category or attribute values. Northstar's backend, CloverCatalogStorefront in commerce_core/storefront.py, ranks the merchant's Clover items by weighted keyword match with a small synonym table. A product with sizes or colors is a family whose id starts with IG-; get_product_details lists its variants with their own 13-character ids, prices and stock. In the fixture the Ridgeline Trail Boot in a size 10 has no stock, so the assistant says so and offers the nearest size; the waterproofing question is answered from the product's specs, or the assistant says the record does not say.
Every result reaches the model inside the blueprint's data fence, and every product id the model later uses must have come back from a catalog or order tool this session (tests/test_checkout_handoff_turn.py::test_cart_write_needs_provenance shows an invented id held). The cards are drawn by present_products, whose payload carries ids, a layout and one reason per pick; the storefront fills in title, price and image. The search-discovery skill loads for requests with several constraints or a search that came back empty; purchase-research for a question about what matters in a category (Skills and modules).
Planning and comparison
At Lumen Home a shopper asks: "Set up a home office in a small spare room for about $800." The assistant runs several searches in one round, lays the answer out as a plan (desk, chair, lighting, storage) with products attached to each step, and adds the prices up before saying whether the set fits the budget. "Compare the two chairs" produces a side-by-side card with pros, cons and what each is best for; the storefront adds the price difference.
The cards are the blueprint's present_plan (steps with product_ids, the pick first), present_comparison (two to four finalists, up to six dimensions, an optional recommendation) and present_guide (sections of know-how for advice that carries no product). The enrichment in the blueprint's shopping_agent/enrichment.py joins every id to the session's records and drops any it cannot find; the planning-goals skill carries the rules.
Adding to the cart and the cart panel
"The family tent sounds right, add it" becomes an add_to_cart call with an id the session has seen. A family needs a variant: the gate holds an add of a product that still has options to choose and points the model at its variants. update_cart_item and remove_from_cart are the only other writes; get_cart reads the lines and subtotal.
The cart panel (web/storefront/components/CartPanel.tsx) is deliberately thin. Its quantity stepper and remove links send messages to the assistant ("Change the Basecamp 4-Person Family Tent quantity to 2."), so the same executor and gates handle every change. The add button on a product tile posts to /api/cart/add, which runs add_to_cart through the same executor and queues a note the assistant reads at the start of its next turn. Two links under the subtotal prefill "How can I pay?" and "Ask about this cart". Every cart payload also carries the processor's name, the checkout model and, once a checkout is staged, checkout_url, checkout_label and checkout_status_url, added by cart_extras_for in verticals/_host.py from the gateway; the model never writes them.
Asking how to pay
With a $219 tent in the cart, the shopper clicks "How can I pay?". The assistant answers with one sentence and a card headed "Ways to pay · $219.00", tagged "via Clover". The rows say what each tender is worth on this cart: Klarna at 4 × $54.75, a gift card with $40.00 applying and $179.00 left to pay, Pay by Bank, and cards and wallets marked "Available at checkout". A line reads "Trailhead Rewards: Earn 657 points on this order" (Sam, the demo shopper, is in the summit tier, which multiplies the store's two points per dollar by 1.5), and the footer states that payment is completed on the store's secure checkout page and nothing is charged here.
The assistant chose to show the card and authored none of the numbers. present_tender_options is a presentation extension in commerce_core/tender.py whose only model-supplied field is an optional 200-character note. Its enrich hook refuses a backend without a processor gateway and refuses an empty cart, then reads the cart and the shopper's loyalty tier and asks the gateway for the rows. The arithmetic is psp_commerce/reporting.py::tender_rows: tenders outside their minimum or maximum are dropped, a store card's reward is the subtotal times its reward_pct, a split tender divides the subtotal by its split, a gift card row carries balance, amount applied and remainder, and the loyalty row multiplies subtotal, points per dollar and tier multiplier. Tenders, offers and loyalty programs are declared per merchant in verticals/registry.py (Lumen Home's store card pays 5% back; its Affirm plan starts at $150).
.venv/bin/python -m pytest tests/test_tender_extension.py -q
2 passed
The test checks that the card's figures equal the gateway's arithmetic and that an empty cart or a backend without the gateway gets a refusal. The tender-and-loyalty skill says when to show the card, where the terms behind a tender come from (search_policies), and what the flow never does: charge, apply a tender, redeem points, or state an approval.
Checkout on each of the four integration models
"Check out my cart" produces a checkout call, which the blueprint defines as staging the cart as a summary the customer confirms in the app; it places no order and charges nothing. The card (web/storefront/components/generative/CheckoutSummary.tsx) is headed "Ready to check out" with a "Not charged" pill, the lines, the estimated total, and one button. In the hosted model its label names the merchant: "Pay securely · Northstar Outfitters", "Pay for your trip · Aurora Escapes", "Pay and activate · Beacon Wireless", "Pay for your tickets · Encore Seats". The cart panel grows the same button.
Where the button goes is the merchant's choice, and the model never sees it. The blueprint's executor calls the backend's checkout_handoff after the model's checkout call and puts the returned URL on the card; the model receives only a staged confirmation. tests/test_checkout_handoff_turn.py runs search, add and checkout through a scripted model and asserts the URL appears in the UI event and in no request body sent to the model.
The choice is CHECKOUT_MODEL, one of four values, each a mixin in psp_commerce/integration/ that compose(store_class, model) places ahead of the store's own backend class. Every merchant's build_backend composes its store that way, so the same variable means the same thing at Northstar, Lumen, Aurora, Beacon and Encore.
| Model | The button opens | Who renders and collects | Who authorizes | How the store learns of completion |
|---|---|---|---|---|
hosted (default) |
the processor's page | the processor | the processor | the return redirect, the storefront's status poll, or the webhook |
server |
the store's own page, /store/checkout/pi_… |
the store's page | the store's server, calling the processor's API | the store's own pay route |
dropin |
the store's own page, /store/checkout/cs_…, with the processor's component inside it |
the processor's component | the processor | the webhook (simulated in-process in the demo) |
link |
a processor-hosted payment link | the processor | the processor | the link's status route or the webhook |
On the simulated gateway the hosted page is the demo page in commerce_core/hosted_checkout.py at /checkout/{id}: the order, one button per tender, the loyalty line. On a live processor it is the processor's page: Stripe Checkout (POST /checkout/sessions, ui_mode=hosted_page); Adyen's Hosted Checkout (POST /sessions, mode: "hosted", served from test.adyen.link in the test environment); Worldpay's Hosted Payment Pages (POST /payment_pages); a CyberSource payment link (POST /ipl/v2/payment-links; Secure Acceptance is a signed form post and is not wrapped); Clover Hosted Checkout (POST /invoicingcheckoutservice/v1/checkouts, a 15-minute session). Each adapter's docstring in psp_commerce/adapters/ names its endpoints, read from the vendors' documentation on 6 September 2026: Stripe, Adyen, Access Worldpay, CyberSource, Clover. The processor-by-processor account is Payment processors.
In the server model the store's page (psp_commerce/checkout_pages.py) lists the tenders the processor allows for the amount, and its Pay button posts to the store's server, which calls the processor's authorization API (a Stripe PaymentIntent confirm, Adyen /payments, Worldpay /api/payments, CyberSource /pts/v2/payments, Clover /v1/charges); the intent is created when the checkout is staged, so the tender card, the page and the authorization price the same lines. In the dropin model the cart payload carries a dropin block (session id, client key, the payment methods the processor returned) and the store's page hosts the processor's component (Stripe's embedded Checkout, Adyen's Drop-in, Worldpay's Checkout SDK, CyberSource Unified Checkout, Clover's iframe); the demo page stands in for the component with tender buttons. In the link model the button carries a processor-hosted payment link (Stripe Payment Links, Adyen Pay by Link, CyberSource, Clover Hosted Checkout, Worldpay Hosted Payment Pages), which can equally be sent by email or handed to a platform agent.
.venv/bin/python -m pytest tests/test_integration_models.py -q
9 passed
That test runs the hosted, server and drop-in models on Lumen Home and asserts the tender card is identical across them. Verified live: Stripe on 6 September 2026 (hosted and embedded sessions, PaymentIntent confirm and capture, Payment Links) and Adyen on 7 September 2026 (hosted session, payment link, embedded session, /paymentMethods and /payments; Drop-in needs a client key on the credential to mount). Worldpay, CyberSource and Clover: not run in this repository.
Paying and returning
On the simulated gateway the shopper presses a tender on the demo page, which posts /checkout/{id}/complete, a demo control that plays the part of the processor's webhook. On live Stripe the shopper pays on Stripe's page with Stripe's documented test card (4242 4242 4242 4242, any future expiry, any CVC); on live Adyen with Adyen's (4111 1111 1111 1111, expiry 03/2030, CVC 737).
The processor then sends the browser to the merchant API's return page: Stripe's success_url is /checkout/return?session_id={CHECKOUT_SESSION_ID}; Adyen's returnUrl is /checkout/return, to which Adyen appends sessionId and sessionResult. Adyen refuses a session read without that sessionResult (error 29_004, seen live on 7 September 2026), so the route hands it to the adapter's record_session_result first. The route in commerce_core/hosted_checkout.py then reads the session from the processor, records the transaction and the order, and queues a note for the assistant, once per session. The page says "Payment received" with the order and transaction ids and a "Back to the store" link (STORE_URL, set by scripts/run_demo.py).
The storefront notices on its own: the cart panel's button polls checkout_status_url every 2.5 seconds once clicked. On a live processor the checkout URL is on another origin, so the poll goes to the merchant API's /checkout/{id}/status route (status_url_for in verticals/_host.py), and when the status leaves created the panel refetches the cart. The status route queues the same note if the return page has not, so the assistant is told exactly once; processor webhooks (psp_commerce/webhooks.py, Stripe and Adyen signatures verified) feed the same hook.
The assistant learns of the payment the way it learns of anything outside the conversation: the host prefixes the shopper's next message with a bracketed "App events since your last reply" note (append_user_turn in the blueprint's demo_common/host.py), which in the hosted model reads "Customer completed checkout … on the hosted payment page with card; order … was placed and USD 219.00 captured (transaction …). The cart is now an order." Asked "did my payment go through?", the assistant answers from that note and from get_orders, which merges the store's order fixtures with the processor's completed checkouts read back as orders (processor_orders in commerce_core/storefront.py); present_order_status draws the status card, and the blueprint's grounding rule makes a post-purchase question start from an order read. tests/test_demo_paths.py::test_return_leg_notifies_the_assistant_once runs the return page before and after payment with Stripe's and Adyen's parameter names.
Memory and personalization
Sam says "remember that we pick up in Duluth rather than shipping". The assistant loads memory-personalization, saves the fact and confirms it. A week later, "a sleeping bag for our 8-year-old" is answered with pickup assumed.
save_memory takes a key of at most 64 characters, a value of at most 200, and a category (preference, constraint or context); the write filter in the blueprint's commerce_common/memory.py bounds what is kept. recall_memories searches older facts by topic when one would change the pick, and the first tier of facts rides in the per-request context on every turn. Northstar and Lumen use JsonFileMemoryStore on data/.memory-store.json, so memory survives a restart; Aurora, Beacon and Encore use an in-memory store that MemorySeeder refills from data/memory-seed.json at boot (Northstar's seed gives Sam a camping style, the pickup preference and a tree-nut allergy recorded as a constraint). Lumen's starter "Order me the same resistance band set I bought before" is the order-history version: the assistant finds the set in get_orders and adds it.
Policies and customer care
"When can I pick up my sleeping bag order?" is a post-purchase question, so the turn starts from get_orders, where Sam's fixture order for a youth sleeping bag is in processing and marked ready for pickup. "Can I still return the boots I bought in August?" starts from search_policies, and the customer-care skill's rules apply: every date and term comes from a record fetched this conversation, status first and then the next step, eligibility computed from the record, the terms and today, and anything that alters the record or moves money handed to the store's support flow.
Northstar's data/policies.json holds ten pages, from returns and pickup to Trailhead Rewards, Pay in 4 and two buying guides. get_fulfillment_options at Northstar quotes free pickup at the Duluth store with a time computed from opening hours and ground shipping at $7.95 in 2 to 4 business days; at Lumen the retail example's options are returned with the store's name on the pickup location.
The operations assistant
The operator opens the portal (:3110 for Northstar, :3116 for Lumen Home) to a one-sentence briefing, what needs attention, and a panel headed "Money" and the processor's name with four tiles: settled volume over seven days, authorization rate, the share of sales an AI agent initiated, and open disputes, with a warning when any is due within seven days and the tender mix of the latest settlement batch. Each tile prefills a question for the assistant.
Dana, Northstar's operator, clicks the disputes tile, which asks which disputes are due in the next seven days and what each is about. The assistant loads payments-operations, leads with the disputes due within seven days from get_order_issues (reason code, amount, stage, deadline) and, when asked whether agent-placed orders dispute more than the rest, queries dispute_rate and agent_initiated_share and runs one SQL join through run_analysis. It closes by naming the processor's dispute portal as where a response is filed and says nothing has happened here.
Underneath is PaymentsOpsMixin in commerce_core/merchant.py, mixed in ahead of the merchant's existing backend. It answers query_metrics for settled_volume, auth_rate, dispute_rate, chargebacks, agent_initiated_share and tender_mix:<tender> from the gateway's transaction records (psp_commerce/reporting.py::metric_series) and passes every other metric to the store's own backend. It prepends open disputes to the order issues (the blueprint's OrderIssue has no dispute kind, so a dispute is filed as a buyer message carrying reason code, amount and "respond by"), adds a payments block and a "disputes are read-only here" limitation to the merchant context on every request, and adds transactions, settlements and disputes tables to the analysis delegate's SELECT-only SQL view. settlements comes from settlement_batches: one row per settlement date with gross, fees (the tender's rate plus a per-transaction fee), net, count and mix by tender; Aurora Escapes settles in two business days, the others the next business day. The blueprint forces a get_business_snapshot read when a performance term meets a question cue, and every merchant's config extends that term list with payments vocabulary (PAYMENTS_METRIC_TERMS in verticals/_rebrand.py).
Writes are staged; the conversation never applies one. Every stage_* tool returns a staged record and a preview card, and apply_change succeeds only for an id the host has marked approved. The approval surface is the Approve button on the preview card: the portal's POST /api/merchant/changes/{id}/apply marks the id, runs the executor, and queues "Operator approved and applied change … from the preview card." for the next turn. At Northstar, CloverMerchantBackend applies a price move or a restock the way the Clover REST API would (update_item, update_item_stock) and refreshes the storefront's catalog at once. Clover has no campaign or promotion object, so stage_campaign and stage_promotion raise ChangeNotApplicable and the config turns campaigns off.
.venv/bin/python -m pytest tests/test_payments_ops.py -q
3 passed
The portal's Home, Catalog, Orders and Inventory views read the same backend, and each merchant router adds a payments read: /payments (30-day summary, settlement batches, disputes) at Northstar and Lumen, /occupancy at Aurora, /base at Beacon, /pacing at Encore.
What each vertical adds
Each vertical extends the same two assistants with its own presentation components and rules, registered through the blueprint's extra_presentation_tools; the tender card is registered beside them at every merchant.
| Vertical | Merchant (API, store, portal) | Storefront extension | Portal extension |
|---|---|---|---|
| Retail | Northstar Outfitters, Clover (:8010, :3010, :3110) | Clover families and variants; pickup times from store hours | Clover-shaped listings and alerts; writes to the item API; campaigns off |
| Retail | Lumen Home, Stripe (:8016, :3016, :3116) | price intelligence and review aspects; CHECKOUT_MODEL switching |
KPI trends, insights and campaigns; the payments panel |
| Travel | Aurora Escapes, Adyen (:8017, :3017, :3117) | present_itinerary, a trip laid out day by day; dated searches; a stay's first add books the planned nights; label "Pay for your trip" |
present_occupancy_calendar; date-window rate moves; /occupancy |
| Telecom | Beacon Wireless, Worldpay (:8018, :3018, :3118) | present_plan_comparison; present_disclosure; account context every turn; the add button limited to devices and add-ons; 24-month installments; label "Pay and activate" |
present_plan_mix; price moves that state the lines affected; protected fee fields; /base |
| Ticketing | Encore Seats, CyberSource (:8019, :3019, :3119) | present_venue_map; present_hold, an eight-minute hold that is the cart; waitlist, wallet and transfers; seats sold together requested in whole sets; label "Pay for your tickets" |
present_event_pacing; hold releases that add capacity; fee-preserving price moves; /pacing |
The travel, telecom and ticketing extensions are the blueprint's own, imported from its vertical examples; the reference rebrands the example configs (verticals/_rebrand.py) and adds the checkout mixin, the tender card and PaymentsOpsMixin to each. The platform agents that shop at these same merchants from outside are in Third-party agents; the loop that runs the store's assistant on a provider other than Claude is in Any model.