Orders
Create an order
POST /api/web-orders/v1/orders
Authorization: Bearer <token>
X-Idempotency-Key: SITE-10023
Content-Type: application/json{
"externalOrderId": "SITE-10023",
"customer": { "name": "Ayşe Y.", "phone": "+905321234567" },
"delivery": {
"type": "delivery",
"address": {
"text": "Atatürk Cd. No:5 Kadıköy/İstanbul",
"doorNo": "4", "flatNo": "7", "directions": "Above the pharmacy",
"lat": 40.9901, "lng": 29.0275
}
},
"items": [
{
"productId": "8f1c2a90-6c1e-4f6b-9a0e-1b2c3d4e5f60",
"name": "Adana Wrap", "quantity": 2, "unitPrice": 180.00, "note": "no onions",
"options": [ { "name": "Ayran", "price": 20.00 } ]
},
{ "externalProductId": "SKU-55", "name": "Künefe", "quantity": 1, "unitPrice": 150.00 }
],
"deliveryFee": 25.00,
"discount": 0,
"total": 575.00,
"payment": { "status": "paid", "method": "online" },
"note": "Do not ring the bell"
}201 response:
{ "success": true, "data": { "orderId": "e5a9f0d3-...", "orderNumber": "WB-261109-14", "status": "pending", "test": false } }Store orderId: status, cancel and webhooks all carry it.
Fields
| Field | Required | Notes |
|---|---|---|
externalOrderId | yes | Your order number, up to 64 chars. Echoed back in webhooks |
customer.name, customer.phone | recommended | So the courier and restaurant can reach the customer |
delivery.type | yes | delivery or pickup (customer collects, no courier) |
delivery.address.text, lat, lng | yes for delivery | Location drives courier assignment |
items[].name, quantity, unitPrice | yes | Quantity is an integer ≥ 1 |
items[].productId | no | Hızlıyo product id (catalog); lets stock and reports recognise the item |
items[].externalProductId | no | Your SKU (for your records). Items without productId are taken by name; stock deduction and product reports will not recognise them |
items[].options[] | no | Options (name + price), price per unit |
deliveryFee, discount | no | Default 0 |
total | yes | What the customer pays |
payment.status | yes | paid (charged on your site, courier collects nothing) or unpaid (pay at the door) |
payment.method | yes when unpaid | cash or card |
note | no | Order note; item notes are shown to the restaurant together with it |
Rules
- The total must add up:
Σ (unitPrice + option prices) × quantity + deliveryFee − discount = total(±0.01), otherwiseTOTAL_MISMATCH. You own the prices; Hızlıyo does not reprice against its menu. - Idempotency: send
X-Idempotency-Key(falls back toexternalOrderId). A repeat with the same key and body returns the first response and creates no second order; the same key with a different body isDUPLICATE_ORDER(409). - Acceptance: if the restaurant accepts orders manually the order comes back
pending; with auto-accept,accepted. Either way, the next steps arrive as webhooks.
Get status
GET /api/web-orders/v1/orders/{orderId} returns orderId, externalOrderId, orderNumber, status, createdAtUtc, lastStatusChangeAtUtc.
status | Meaning |
|---|---|
pending | Waiting for the restaurant to accept |
received / accepted | Received / accepted by the restaurant |
preparing, ready | Being prepared, ready |
picked_up, on_the_way | Courier picked it up, on the way |
delivered | Delivered |
cancelled | Cancelled or rejected |
Webhooks are the primary channel; use this when one is missed (600 requests per minute).
Cancel
POST /api/web-orders/v1/orders/{orderId}/cancel with { "reason": "..." }. Only while the order is pending. After the restaurant accepts, the kitchen may have started: you get CANCEL_NOT_ALLOWED (409) and the customer should call the restaurant.
Catalog
GET /api/web-orders/v1/catalog returns the restaurant's items on sale (Hızlıyo product id, name, price, options). It is available when Hızlıyo has linked a catalog to your credentials; otherwise CATALOG_NOT_CONFIGURED (404) — keep sending items by name and price.
Is the store open?
GET /api/web-orders/v1/store/status → { "acceptingOrders": true }. Informational, for showing "we're closed" on your site; the restaurant may reject orders received while closed.