Place an order
place_orderPlace an order against the agent_session_id from start_order_session. Atomically inserts the order + items, applies server-side canonical pricing + tax (do NOT trust the unit_price you compute — we re-read it from D1), decrements inventory, optionally redeems a promo code, and creates a Stripe hosted Checkout Session so the customer can pay + authenticate on their own device. Returns order_id, total_cents (tax-inclusive), currency, promo_discount, and a hosted_confirm_url (a Stripe checkout link) to share with the human. Idempotency-Key header REQUIRED.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | Optional order-level note (max 500 chars). | |
| items | Yes | ||
| room_id | No | Diamond tier only — hotel room id. | |
| table_id | No | Optional table id when ordering at a table. | |
| guest_name | No | Required when room_id is set. | |
| order_type | No | Channel: 'dine_in' (default — table or room) or 'takeaway' (pickup; requires customer_name + customer_phone, ignores table_id/room_id, only when the restaurant has takeaway enabled — else channel_not_available). Delivery is not offered to agents. | |
| promo_code | No | Optional promo code to redeem at order time (validate first with apply_promo). The redemption slot is consumed only when this order lands. | |
| customer_name | No | Required for takeaway — who picks the order up. | |
| customer_phone | No | Required for takeaway — reachable phone (digits, +, spaces/dashes tolerated). | |
| agent_session_id | Yes |