Skip to main content
Some stores, such as DoorDash, place an order only on the shopper’s own account. When the shopper reaches checkout at one, your agent sends a sign-in link named for the store. The shopper signs in on the store’s page, returns to the chat, and the purchase continues without them typing “done”. The tool hands a store_login link to sendLink when the shopper needs to sign in before Agentcard can buy at the store. The link names the store in store, and the model reads next_action: store_login and links_sent with store_login in it.
chat.ts
The model asks for one step at a time, in the order a purchase needs them: a shipping address and phone (shipping_details), a name, email, and phone for a booking (guest_details), the store sign-in (store_login), a card in the Vault (add_card), the shopper’s yes to the cart (confirm), the code a booking texted them (verification_code), then the approval (approve). A shopper who still has a card to add hears about the sign-in first, and the card second. The message that asks for the sign-in is one short line, such as “sign in to doordash to place your order”. The model names the link by what it is for, so a store sign-in is never called a card link. Render the link as one clear call to action. “Sending each link” shows how to deliver it and how to open it in a pop-up.

Hear that the shopper signed in

Agentcard tells your server how the sign-in ended. Each message carries text ready to post: After store_connected, the agent takes the next step on its own, as “Taking the next step once the shopper finishes outside the chat” shows. With a card still to add, the next message is the add-card link. With a card on file, it is the cart’s total and the ask for the shopper’s yes, or the approval link after a yes that stopped for the sign-in.

Sign in to two stores at once

A shopper can hold a sign-in link for two stores, and a cart at each. A store_connected message for DoorDash never ends a sign-in the shopper has open for Locale: actionLinkOutcome compares the store in the link with the store in the message’s facts.merchantName. The same rule keeps an approval for one store’s cart open when a message arrives about another store.

Show the cart as an estimate

A store that prices a cart only once the shopper’s own account holds it returns a cart with totalIsEstimate: true. DoorDash is one. The total covers the items and the known fees, so show it as an estimate. The model reads total_is_estimate and total_leaves_out, and it says the total is before those costs, such as “about $18.41 before tax and shipping”.

Check it in the sandbox

  1. Send “get me tacos” to your agent as a test shopper, and pick a store.
  2. Add a dish, then say “ok lets checkout”. Check that a store_login link arrives, named for the store, and that the model’s reply holds no link.
  3. Open the link and sign in to the store with an account of your own. The sandbox stops before payment.
  4. Check that the chat posts the sign-in message without you typing anything, and that the next message is the add-card link or the ask for your yes.
  5. Open a second sign-in link for another store and finish only the first. Check that the second link stays open.