Order Schema
This document describes the Order object structure used throughout the API.
Order Object
- TypeScript
- Example
type Order = {
id: string; // Unique order identifier
status: 'new' | 'future' | 'rejected' | 'cancelled' | 'ready' | 'finished';
deliveryStatus?: 'ASSIGNED' | 'EN_ROUTE_TO_STORE_LOCATION' | 'EN_ROUTE_TO_CUSTOMER' | 'COMPLETED' | 'CANCELED';
createdAt: string; // ISO 8601 timestamp when order was created
updatedAt: string; // ISO 8601 timestamp of last update
cancellation?: { // Present when order is cancelled
by: 'platform' | 'merchant' | 'system';
reason: string;
at: string; // ISO 8601 timestamp
};
store: Store; // Store information
details: OrderDetails; // Detailed order information
};
Complete order example:
Order Example
{
"id": "3475e4e5-ff33-4acd-bdc6-2937670d10f8",
"status": "ready",
"deliveryStatus": "EN_ROUTE_TO_CUSTOMER",
"createdAt": "2022-06-13T16:20:46.100Z",
"updatedAt": "2022-06-13T16:25:00.000Z",
"store": {
"id": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
"externalId": "gh-les1-tributo",
"location": "Tributo LES",
"brand": "Tributo",
"platform": "grubhub"
},
"details": {
"externalId": "tE3_Qes0Eeyf_V8y5nw54Q",
"externalReadableOrderNum": "56141916-4846305",
"placedAt": "2022-06-13T16:20:46.062Z",
"estimatedPickupAt": "2022-06-13T17:01:00.000Z",
"isPickup": false,
"consumer": {
"id": null,
"name": "Jacob Yee",
"email": "",
"phone": "9548958785"
},
"consumers": [],
"isGroupOrder": false,
"note": "Include napkins and utensils",
"deliveryNote": "Will need to come to the lobby to collect from person Company Name: DailyPay",
"isMerchantDelivery": false,
"deliveryAddress": {
"googlePlaceId": "ChIJVTPokywQkFQRmtVEaUZlJRA",
"lat": 40.7034,
"lng": -74.0098,
"label": "55 Water St, New York, NY 10041",
"raw": "{\"address_line1\":\"55 Water St\",\"city\":\"New York\"}"
},
"total": 2197,
"subtotal": 1975,
"tax": 122,
"tip": 100,
"deliveryFee": 0,
"utensils": true,
"promotions": [
{
"name": "Free delivery",
"discountValue": 349
}
],
"items": [
{
"id": "e1809cd4-7948-4a16-861c-501e094ef02b",
"sku": "SKU-TACO-001",
"name": "Salt & Pepper Shrimp Taco",
"quantity": 1,
"price": {
"base": 1375,
"menu": 1375,
"unit": 1375,
"total": 1375
},
"modifiers": [
{
"id": "66561a41-5f7c-47fc-b44c-31ada1453276",
"sku": "SKU-PROTEIN-BEEF",
"name": "Beef",
"quantity": 1,
"price": {
"base": 0,
"menu": 0,
"unit": 0,
"total": 0
},
"modifierGroup": {
"id": "grp-protein",
"name": "Protein Choice"
}
},
{
"id": "3f20c307-e97e-4111-a476-53039f64a083",
"name": "Salsa Verde",
"quantity": 1,
"price": {
"base": 0,
"menu": 0,
"unit": 0,
"total": 0
}
},
{
"id": "opt-combo-001",
"name": "Combo Extras",
"quantity": 1,
"price": {
"base": 200,
"menu": 200,
"unit": 200,
"total": 200
},
"modifiers": [
{
"id": "sauce-side",
"name": "Sauce on the Side",
"quantity": 1,
"price": {
"base": 0,
"menu": 0,
"unit": 0,
"total": 0
}
}
]
}
]
},
{
"id": "04645392-0bb1-482a-afaf-479df05787b1",
"sku": "SKU-RICE-002",
"name": "Fried Rice",
"quantity": 1,
"price": {
"base": 600,
"menu": 600,
"unit": 600,
"total": 600
},
"note": "No onions",
"modifiers": [
{
"id": "22bbcd65-14d2-4809-a5c1-563c58a0bea8",
"name": "Add Egg",
"quantity": 1,
"price": {
"base": 0,
"menu": 0,
"unit": 0,
"total": 0
}
}
]
}
]
}
}
Order Details
The details field contains comprehensive information about the order:
type OrderDetails = {
// Identification
externalId: string; // External platform order ID
externalReadableOrderNum?: string; // Human readable order number (platform-specific)
source: string; // Integration identifier (e.g. "doordash@1.13.1")
// Timing
placedAt: string; // ISO timestamp when order was received by Mealco
estimatedPickupAt?: string; // ISO timestamp for estimated pickup/ready
// Order Type
isPickup: boolean; // Pickup vs delivery
// Customer Information
consumer: Consumer; // Primary customer
consumers: Array<Consumer>; // All customers (group orders)
isGroupOrder: boolean; // Whether multiple customers are involved
// Notes
note: string; // General order notes
deliveryNote: string; // Delivery-specific notes
// Delivery
isMerchantDelivery: boolean; // Delivery handled by merchant
deliveryAddress?: DeliveryAddress; // Delivery address details
courier?: Courier; // Courier details for platform deliveries
// Financials (cents)
// All monetary amounts are in cents
total: number; // Final order total
subtotal: number; // Items total before tax/fees
tax: number; // Tax amount
tip: number; // Tip amount
deliveryFee: number; // Delivery fee
utensils?: boolean; // Include utensils
// Items
items: Array<OrderItem>; // Line items
// Promotions
promotions?: Array<OrderPromotion>; // Applied promotions
};
type Consumer = {
name: string;
phone?: string; // Contact phone (may be masked)
code?: string; // Code for masked phone numbers
};
type DeliveryAddress = {
googlePlaceId?: string;
lat?: number;
lng?: number;
label: string;
raw: string;
};
type Courier = {
name?: string; // Courier's name
phone?: string; // Courier's contact phone (may be masked)
code?: string; // Code for masked phone numbers
};
type OrderItem = {
id: string;
sku?: string; // Optional SKU when available
name: string;
quantity: number;
price: {
total: number;
unit: number;
base: number;
menu: number;
};
note?: string;
modifiers: Array<OrderItemModifier>;
};
type OrderItemModifier = {
id: string;
sku?: string; // Optional SKU when available
name: string;
quantity: number;
price: {
total: number;
unit: number;
base: number;
menu: number;
};
modifierGroup?: { id: string; name: string };
modifiers?: Array<OrderItemModifier>;
};
type OrderPromotion = {
name?: string;
discountValue?: number; // cents
discountPercentage?: number; // e.g. 40 for 40%
};
Store Information
type Store = {
id: string; // Unique store identifier
externalId?: string; // Partner-facing store ID (e.g., POS ID)
location?: string; // The store's location name
brand?: string; // The brand name
platform: string; // The name of the ordering platform (e.g., "doordash")
};
### Delivery Address Guidance
For highest accuracy, it is strongly recommended to **use the `deliveryAddress.raw` field as the source of truth** and perform your own geocoding. The `lat` and `lng` fields are provided for convenience but may not always be present or reliable across all ordering platforms.
### Item Structure
```typescript
type OrderItem = {
id: string; // Item identifier
sku?: string; // SKU when available
name: string; // Item name
quantity: number; // Quantity ordered
price: {
total: number; // Total price (cents)
unit: number; // Unit price including modifiers (cents)
base: number; // Base price without modifiers (cents)
menu: number; // Menu price (cents)
};
note?: string; // Item-specific notes
modifiers: Array<OrderItemModifier>; // Item modifiers
};
type OrderItemModifier = {
id: string;
sku?: string; // SKU when available
name: string;
quantity: number;
price: {
total: number; // Total price (cents)
unit: number; // Unit price (cents)
base: number; // Base price (cents)
menu: number; // Menu price (cents)
};
modifierGroup?: { // Modifier group (e.g., "Protein Choice")
id: string;
name: string;
};
modifiers?: Array<OrderItemModifier>; // Nested modifiers
};
Promotions
The promotions array lists all discounts applied to the order. To calculate the total discount amount, sum the discountValue from each object in the array.
type OrderPromotion = {
name?: string; // Promotion name
discountValue?: number; // Discount amount (cents)
discountPercentage?: number; // Discount percentage (e.g., 40 for 40%)
};
Related Documentation
- Orders API - Retrieve orders
- Webhooks - Real-time order notifications
- Order Actions - Update order status