validate_order, quote_order, and submit_order share one canonical order-intent shape; the by-id tools enforce ownership (an agent only touches orders it created).
validate_order
Run Phantom rule validation before quote or submit. Input —{ "restaurant_id": "…", "order": <canonical order intent> }:
restaurant_idat the tool level and insideordermust match, or the call throws.order.agent_idis optional — omit it. Phantom stamps the authenticated agent from your API key, which is why no example here sends one (you have no way to know your own Phantom agent id before your first call). Supplying a different one throws.requested_fulfillment_timeis ISO-8601 and accepts a UTCZinstant or an explicit offset (2026-08-11T12:00:00-07:00); it is normalized to UTC on the way in, so what you read back is alwaysZ. Every tool taking a time uses this same contract.fulfillment_addressis required for delivery; sendlatitude/longitudewhen the client’s address autocomplete has geometry (courier dispatch needs them).address2(unit/apartment/suite) is optional and part of the address — it reaches both the courier and the restaurant. Dropoff instructions belong innotes, which only the courier sees when one is engaged.- Per-player naming: a line with
player_first_namemust carryquantity: 1— two players means two item lines. - Some restaurants (
capabilities.hours: "unknown") validate only the cart — item and option availability, the dropoff — and there is nofulfillmentTimeecho. Problems come back asitem_unavailableissues or as refusals — see Rules that vary by restaurant.
fulfillmentTime echoes the requested instant as a wall clock in the restaurant’s timezone. Check restaurantLocal against what the user actually asked for: a time resolved against the end user’s zone instead of the restaurant’s is a perfectly valid instant for the wrong hour, and this is where you catch it.
Issue codes currently emitted:
ordering_disabled, channel_deactivated, restaurant_closed_at_time, location_paused, lead_time_too_short, lead_time_too_long (scheduled more than 7 days out — the platform scheduling horizon), headcount_too_large, fulfillment_type_not_allowed, self_delivery_not_enabled, menu_version_stale, player_name_incomplete, player_name_requires_separate_item_line, item_not_found, item_unavailable, item_unavailable_at_time, mapping_needs_review, modifier_group_invalid, modifier_invalid, modifier_unavailable, nested_modifier_quantity_invalid, modifier_not_nested, required_modifier_missing, too_many_modifiers, modifier_quantity_exceeded, too_many_items, order_value_too_large.
Some codes are error codes, not issue codes: they arrive as a thrown tool error, never as an entry in issues[]. Over MCP the error’s text is its message, not the code — see Errors for the tags you can match on. order_validation_failed lists each blocking issue as code: message in its text.
Some restaurants add refusals of their own — dropoffs, scheduled times, order size caps, rate limits, duplicate submits. They are listed under Refusals.
quote_order
Return pricing for a valid order. Input: same{ restaurant_id, order } shape as validate_order.
Output:
deliveryFeeCents is the courier fee, already folded into totalCents; it is 0/absent on pickup or when no dispatch quote was available. serviceFeeCents is the MealOps consumer service fee, a share of the subtotal. serviceFeeBps is the rate it was computed at, in basis points of the subtotal (500 = 5%, the default): your agent’s configured rate, or a per-team or per-user rate MealOps has set up for you, matched on the order’s metadata.team_id / metadata.owner_user_id. It is absent only on quotes stored before the field existed.
A clean quote does not guarantee a submit. Three issue codes are deliberately non-blocking at quote time — order_value_too_large, too_many_items, and headcount_too_large — so a customer still sees priced totals for an over-cap cart. start_payment and submit_order both reject them. Read validate_order’s issues[] rather than treating a successful quote as a green light.
Idempotency replays are re-shaped to this current schema before being returned.
Itemized quotes
Whencapabilities.pricing is verbatim_line_items, the quote also carries the itemized charges behind its totals, plus the MealOps service fee:
serviceFeeCentsis the full service fee, MealOps fee included;platformServiceFeeCentsis the MealOps part, so a checkout can show it as its own row. Both are already intotalCents.otherFeesCents/otherFees— charges that are neither delivery, service, nor tax (a bag fee, say), labeled as reported. Never folded intoserviceFeeCents.promoDiscountCents— discounts, as a positive amount already subtracted fromtotalCents.providerLineItems— itemized charges as the restaurant’s source reports them (label,amountCents, optionaloriginalCentsandtooltip); render as given.deliveryAvailability— the live answer for this cart: whether delivery is available, whether ASAP is possible for delivery and pickup, and ETA ranges as display text.quotedItems— the per-line prices behindsubtotalCents. They can differ from menu prices (pickup is often cheaper), so reprice your stored lines from here rather than from the menu.orderingMode—liveplaces a real order;mockmeans this order will run end to end but won’t be sent to the restaurant or charged. Show it (“test mode”) before the user commits. See test mode.tipCentsis always0on a pickup order here: a pickup tip is never priced, held, or sent.- Other informational fields may appear; don’t depend on them.
Scheduled times
Whencapabilities.hours is unknown, there are no store hours to check against. Instead, every quote checks the requested time against the times the restaurant will actually schedule for the cart’s fulfillment type — which can have gaps (a store open all day may take scheduled delivery only in the evening) and reach only a few days ahead. quote_order refuses with the error scheduled_time_unavailable when:
- the time falls outside every window that day (before opening, after closing, or in a gap),
- the day is further ahead than the restaurant schedules,
- the restaurant takes no scheduled orders at all, or
- the order is ASAP and ASAP isn’t possible right now (a closed store that takes orders for later).
[scheduled_time_unavailable] so a client can recognize it. Relay the sentence (without the tag), ask for a time inside the named hours, and never retry the same time or guess hours. submit_order repeats the check at the last moment, so a quote that went stale is refused the same way before anything is placed.
submit_order
Create the order in Phantom and enter the provider-submission lifecycle. Orders auto-approve — there is no manager review step. Input: same{ restaurant_id, order } shape as validate_order.
Output:
submit_order never bypasses the restaurant’s ordering rules — opening hours, busy-mode pause, lead times, and caps are all enforced server-side, on exactly the same code path validate_order runs.
The payment must cover the order. The prepaid gate checks the amount, not just that a payment exists: an authorization smaller than the order total is rejected with payment_amount_insufficient, naming both figures. This matters because the payment is matched by external_order_reference, and most clients keep that reference stable across cart edits — so a hold placed on an earlier, smaller cart would otherwise carry a larger order. If the cart changed after you started payment, call start_payment again with the current order: it releases the previous hold and authorizes the new total under the same reference. An authorization larger than the order is accepted, and capture takes only the order total.
When capabilities.pricing is verbatim_line_items, the response also carries quote — the money lines of the cart actually placed (the same fields as an itemized quote), with totalCents equal to totalEstimateCents, the amount capture is bounded by. There is no fulfillmentTime echo for these orders; see After placement for when they are captured.
get_order_status
Phantom’s last known order state, latest provider order identifier, and the payment snapshot. Input:{ "order_id": "order_123" }
Output:
payment is null when no payment record exists. get_order_status exposes Phantom’s order lifecycle, not raw provider-only state.
totalEstimateCents is Phantom’s own quote total for the order — the same figure the payment gate and the capture use — never a total supplied by the caller.
Some orders also carry an optional provider object with upstream status details; treat it as informational. If it has actionRequired: true, the order is on hold, not failed — show it as on hold even when status is failed. For these orders:
totalEstimateCentsisnull.paymentis the customer’s payment snapshot (what was held, captured, or refunded) — showpayment.amountCentsas what was charged — and once the order completes,receipthas the finalized money.- A test-mode order (placed while
orderingModewasmock) reportsstatus: "accepted"withprovider: nulland never gets a receipt.
capabilities.pricing is verbatim_line_items, a completed order’s get_order_status and get_order_tracking also return a receipt: the finalized itemized charges, MealOps service fee included. serviceFeeCents and totalCents are the customer-facing figures. receipt is null until the charges are finalized, and absent on other orders.
otherFees carries charges that are neither delivery, service, nor tax (a bag fee, say), labeled as reported; they are never folded into serviceFeeCents. The same fields appear on itemized quotes. The receipt can carry other informational fields; don’t depend on them.
get_order_tracking
Full tracking snapshot: kitchen status + timestamped status-event timeline, and for delivery orders the courier leg. Input:{ "order_id": "order_123" }
Output:
delivery: null.
For some orders, tracking is coarser:
statusEventscarries only the current stage, anddriveris alwaysnull.requestedFulfillmentTime,fulfillmentAsap, andcreatedAtarenull, andfulfillmentTypecan benulluntil it is known.- Pickup orders get a
pickupblock (estimatedPickupTime,actualPickupTime) instead ofdelivery. receiptarrives once the order completes. Other informational fields may appear; don’t depend on them.
cancel_order
Cancel a pending order the calling agent placed. Only possible before the restaurant accepts it. Cancels the POS ticket and any courier, and best-effort reverses the payment (refunds captured charges, voids held authorizations). Input:{ "order_id": "order_123", "reason": "Customer changed plans" } (reason optional, ≤200 chars)
Output: { "ok": true, "status": "cancelled", "message": "…", "payment": "refunded" }
There is deliberately no restaurant-access check here: an agent must be able to cancel its own pending order even if the restaurant has since disabled ordering or its channel was deactivated.
Some orders can’t be cancelled after placement; the call refuses.
update_order
Update a live order’s fulfillment details and re-point any courier (partial PATCH). Input:status echoes the order’s current lifecycle status, not an update result.
A new requested_fulfillment_time clears the same time gate submit_order enforces — opening hours, paused kitchen, lead-time floor, scheduling horizon, and each item’s own availability windows — and is rejected with the usual restaurant_closed_at_time / location_paused / lead_time_too_short / lead_time_too_long / item_unavailable_at_time codes otherwise (as an order_validation_failed error). The check runs before the courier is contacted, so a rejected update moves nothing. A call with nothing to change, or on an order past the editable statuses, is refused.
The fulfillment time is only editable until the restaurant accepts. Once the order reaches accepted (or preparing / ready), a time change is rejected with order_already_accepted. Deliverect has no order-update API, so the kitchen’s ticket keeps the original time no matter what — changing it here would only re-point the courier, and the food would come up at the original hour and sit. Cancel and reorder if the time really has to move. The dropoff address and notes stay editable after acceptance: those are courier-only details the kitchen never sees.
A delivery edit re-prices the order. The courier fee depends on where and when it delivers, and it is part of the total the eater paid — so changing a delivery order’s dropoff address or time re-quotes it before contacting the courier:
- The new quote becomes the order’s total, and capture follows it. A cheaper move is simply captured cheaper.
- If the new total exceeds the payment already held on the order’s
external_order_reference, the update is rejected withpayment_amount_insufficientand nothing moves — not the address, not the courier. Cancel and reorder at the new price. - Re-quoting also re-checks courier coverage, so a dropoff the courier will not serve fails here with
delivery_unavailablerather than at dispatch.
Rules that vary by restaurant
Some restaurants add rules of their own. They use the same tools and the same order intent; where a rule applies, thecapabilities block, a quote field, or a refusal tells you.
Building the order
- Pickup or delivery only. Some restaurants refuse
eat_inandcurbside(fulfillment_unsupported). - Saved dropoffs. When
capabilities.addressesisprovider_saved, the restaurant delivers only to a registered delivery address. Always sendfulfillment_addresson a delivery intent, picked fromlist_saved_addresses— Phantom matches it to the saved entry by street and ZIP, or by coordinates. A delivery with no dropoff is refused, and so is a dropoff that matches nothing; register a new one withfind_address_candidates+save_delivery_addressfirst.check_delivery_availabilityanswers the same question ahead of time. - Validation checks the cart. When
capabilities.hoursisunknown,validate_orderchecks only the cart: item and option problems come back asitem_unavailableissues; a line missing a required choice is refused with a message naming it (“Classic Burger” needs a choice for: Size …). - Pickup tips. Some restaurants ignore
tip_centson pickup orders — it is never priced, held, or sent. - Price guard. Put the total you showed the customer in
metadata.expected_total_centsand the submit re-checks it: if the price of the cart has moved by more than $1.00, the submit is refused withprice_driftbefore anything is placed. Re-quote and confirm the new total.
ASAP and scheduled times
Some restaurants need ASAP marked explicitly. Setmetadata.fulfillment_asap: true on the intent (metadata.delivery_is_asap: true is accepted too). The order then goes in as ASAP and requested_fulfillment_time is ignored — it is only your own estimate of the soonest slot.
Without the flag, requested_fulfillment_time decides:
- More than a minute in the future — a scheduled order, checked against the times the restaurant offers (scheduled times).
- Now, or up to 30 minutes in the past (a “now” that aged while the customer checked out) — ASAP.
- More than 30 minutes in the past, or unreadable — refused, “The requested time for this order has already passed. Choose a new time (or ASAP) and try again.” A scheduled time that cannot be used is never quietly turned into ASAP.
Test mode
Some restaurants’ orders start in test mode until MealOps clears your agent for real orders.quote_order reports which mode a submit would take (orderingMode: "live" | "mock"): mock means this order will run end to end but won’t be sent to the restaurant or charged — submit_order returns a placed-looking order (status: "accepted") and the customer’s hold is released rather than captured. get_payment_status → order.mock says which one an order took. The payment and duplicate-submit checks only arm for real orders, but run the whole flow in test mode anyway, start_payment included — it is the flow you will run live.
Clearance is per agent and, optionally, per end-user account: put your user’s stable account id in metadata.requester_user_id (set it from your own authenticated session, never from client input). Ask support@mealops.ai to clear an agent or specific accounts.
Refusals
Every refusal below happens before anything new is placed or charged. Apart from the last three — which mean the reference already backs an order — the sameexternal_order_reference can be used again once the cause is fixed. The names are for reference — over MCP you receive the message; the ones with a tag can be matched exactly (Errors).
When a submit’s outcome is unknown
Ifsubmit_order fails in a way that may still have placed the order — a timeout, say — the message ends with [submit_outcome_unknown]. Treat that order as possibly placed:
- Don’t void the payment and don’t resubmit. Both are refused while the outcome is unresolved (
void_payment,start_payment, andsubmit_orderon that reference), because the payment may be paying for an order that is on its way. - Read
get_payment_statusfor the reference. Itsorderblock reports what became of the submit:statusissubmitting(still running,inFlight: true),submit_ambiguous(outcome unknown),failed(a clean failure — the reference is reusable), or the order’s lifecycle status once placed, withorderIdset forget_order_status. - MealOps reconciles unknown outcomes. If one doesn’t resolve, contact support.
After placement
- Capture timing. Depending on the restaurant, the hold is captured when the restaurant accepts or when the order is placed — read
get_payment_status. Either way capture is bounded by the quoted total. (Test-mode orders take no real money; see test mode.) - Some orders can’t be cancelled or changed after placement;
cancel_orderandupdate_orderrefuse. Contact support to change or cancel one. - For some orders, a decline or cancellation after placement is not reversed automatically — MealOps handles the refund.
- Track with
get_order_status/get_order_tracking; the finalizedreceiptarrives once the order completes.