Cancel while building
A cancel sent while a cart is still building is now kept. A build whose placeId and restaurantName disagree is refused instead of ordering from the placeId's store. And the store's address now comes with its name.
What changed
POST /v1/carts/:id/cancelon a building cart answers202 { "cart": { "id": "crt_…", "status": "canceling" } }instead of409 cart_not_ready. The cart is released as soon as the build finishes, is never offered to the person, and Layout sends no cart-ready text for it.GET /v1/carts/:idreadscanceling, thencanceled. A confirm on either is409 cart_closed.- A cancel on a cart that was already confirmed is still
409 cart_closed, now witherror.order: the order and its state (placing,placed,unconfirmedorrefunded). - Over MCP, the
ordertool'scancel: truetakes the build'sidempotencyKeywhile the cart is building, and answerscancel.status: "canceling". POST /v1/cartsand/answerwith aplaceIdand arestaurantNamethat name different stores answer409 store_mismatch, and nothing is built.error.storeis{ placeId, name, address }for the store theplaceIdnames, anderror.candidates, when present, are stores matching the name. Over MCP, the build answersstoreMismatch.- The cart's
storecarries the address whenever Layout knows it.GET /v1/orders/:idand every webhook payload addstore_address, null when unknown.
409 {
"error": {
"code": "store_mismatch",
"message": "placeId names Layout Test Kitchen North, which does not match restaurantName. Nothing was built. Ask the person which store they mean and send only that store's placeId, or only restaurantName with near or geo.",
"store": { "placeId": "test_place_branch_north", "name": "Layout Test Kitchen North", "address": "31 Sandbox Way, San Francisco, CA 94107" }
}
}
Why it matters
A cancel sent while a cart was building used to be refused, and the person was then texted to confirm a cart you had abandoned. A placeId and a name that disagree now stop the build instead of ordering from the wrong store, and the address lets the person tell two branches apart before they pay.
What to do
Treat canceling as on its way to canceled, and never confirm it. On store_mismatch, ask the person which store they mean and build again with only that store's placeId. Show store.address beside the store's name. See POST /v1/carts/:id/cancel and Errors.
Breaking changes
None under the versioning policy: canceling is a new cart status, store_mismatch a new error code on a 409, and store_address a new field. Two answers move: a cancel on a building cart used to answer 409 cart_not_ready and now answers 202 canceling, and a request that used to build at the placeId's store despite naming another now answers 409 store_mismatch.