Skip to main content

Orders

A menu order captures what a customer ordered, what it costs, and how it moves through the kitchen. Each order has a type (dine-in, takeout, or delivery), one or more items (with applied modifiers), a complete pricing breakdown, and a status that advances from received to fulfilled. Item names and prices are captured at order time, so the record stays accurate even if the menu changes afterwards.

In the TypeScript SDK each order item references a variantId; in the Python SDK each item references a menu_item_id.

Menu order lifecycleOrders flow pending, confirmed, preparing, ready, completed. Delivery orders insert out_for_delivery before completed. Any order can be cancelled. Payment status (pending, paid, partial, failed, refunded) tracks in parallel.ORDER STATUSpendingconfirmedpreparingreadycompletedout_for_deliverydelivery orders only, before completedcancelledfrom any state, with a cancelReasonPAYMENTpending · paid · partial · failed · refunded (tracked in parallel)

Create an order

import { MenuOrderType } from 'wiil-core-js';

const order = await client.menuOrders.create({
customerId: 'cust_456',
type: MenuOrderType.DINE_IN,
orderDate: Date.now(),
items: [
{
menuItemId: 'item_123',
variantId: 'variant_456',
itemName: 'Cheeseburger',
quantity: 2,
unitPrice: 12.99,
totalPrice: 25.98,
},
],
pricing: {
subtotal: 25.98,
total: 25.98,
},
});

console.log(`Order Created: ${order.id}`);

Get and list

const order = await client.menuOrders.get('order_123');
console.log(`${order.status} — $${order.pricing.total}`);

const result = await client.menuOrders.list();
result.data.forEach(o => console.log(`- ${o.id}: ${o.status} ($${o.pricing.total})`));

Update status

The status update carries optional ready-time estimates so the kitchen and customer stay in sync.

import { OrderStatus } from 'wiil-core-js';

const updated = await client.menuOrders.updateStatus('order_123', {
id: 'order_123',
status: OrderStatus.PREPARING,
estimatedReadyTime: Math.floor(Date.now() / 1000) + 15 * 60, // Unix seconds
actualReadyTime: null,
});

console.log(`Status: ${updated.status}`);

Cancel

const cancelled = await client.menuOrders.cancel('order_123', {
cancelReason: 'Customer requested cancellation',
});
FieldTypeRequiredDescription
idstringautoUnique identifier
typeenumYesdine_in, takeout, or delivery
statusenumNoOrder status (default pending)
itemsarrayYesOrder items (min 1)
customerIdstringYesCustomer reference
pricingobjectYesPricing breakdown (see below)
orderDatenumberYesUnix timestamp of placement
paymentStatusenumNopending, paid, partial, failed, refunded
paymentMethod / paymentReferencestring | nullNoPayment details
locationId / channelId / terminalId / operatorIdstring | nullNoRouting & POS context
orderNumberstring | nullNoHuman-readable number (e.g. "#1234")
requestedTime / estimatedReadyTime / actualReadyTimenumber | nullNoTiming
tableNumberstring | nullNoFor dine-in
deliveryAddressobject | nullNostreet, city, postalCode (for delivery)
specialInstructions / allergies / notesNoOrder-level notes & safety info
externalRefobject | nullNoExternal platform reference
cancelReasonstring | nullNoReason if cancelled

Pricing

The pricing object carries the full breakdown: subtotal and total are required; tax, tip, deliveryFee, discount, and currency are optional.

Order item (MenuOrderItemBase)

FieldTypeRequiredDescription
menuItemIdstringYesMenu item reference
variantIdstringYes (TS)Variant reference (TypeScript order items)
itemNamestringYesName captured at order time
quantityintegerYesQuantity (positive)
unitPricenumberYesPrice per unit at order time
totalPricenumberYesunitPrice × quantity + modifiers
modifiersarray | nullNoApplied modifiers (see Modifiers)
customizationsarray | nullNoname, value, additionalCost
specialInstructionsstring | nullNoItem-specific request
statusenumNoItem prep status (default pending)
menuSetIdstring | nullNoSet reference if from a menu set

Status lifecycle

StatusMeaning
pendingOrder received, not started
confirmedConfirmed by the restaurant
preparingKitchen is preparing
readyReady for pickup/delivery
out_for_deliveryWith the delivery driver (delivery orders)
completedFulfilled
cancelledCancelled (with cancelReason)
returnedReturned

The standard path is pending → confirmed → preparing → ready → completed; delivery orders insert out_for_delivery before completed, and an order can move to cancelled from any state.

Pricing preview

Before submitting, the TypeScript SDK can validate and preview an order's pricing, returning calculated items and pricing, plus errors and warnings (for example, when an item's price has changed). This catches mismatches before the order is placed.

Query options

Orders filter by search, locationId, channelId, terminalId, operatorId, type[], status[], paymentStatus[], customerId, tableNumber, externalSource, and dateRange, sorted by orderDate, createdAt, or totalAmount (asc / desc), with page/pageSize pagination.

tip

Capture item names and prices at order time (the SDKs do this), validate totals with the pricing preview, and record allergies clearly — it is critical for safe food preparation.