What it does
Opens an order on behalf of a user. Dedup key is vendor_order_ref — send the same one twice and you get the first order back with replayed: true.
Body
getUserToken in the mini app.Request schema
{
"user_id": <number>, // required
"vendor_order_ref": <string, 1..40 printable ASCII>, // required — dedup key
"items": [ /* see orderPayment */ ], // required, non-empty
"subtotal": <string, decimal>, // required
"total_amount": <string, decimal>, // required
"delivery_fee": <string, decimal>, // optional
"tax_amount": <string, decimal>, // optional
"currency": <string, ISO 4217>, // optional, defaults to mini-app currency
"delivery_address": <object> | null, // optional
"shop_name_en": <string, ≤120>, // optional — branch name (EN)
"shop_name_ar": <string, ≤120>, // optional — branch name (AR)
"shop_icon": <string URL, ≤2048>, // optional — branch icon
"shop_address": <object> | null, // optional — branch address
"order_type": <string, ≤60>, // optional — "delivery" | "pickup" | ...
"customer_meta": <object> | null // optional — free-form JSON
}Response
true on 2xx. Check the HTTP status code for error branches.true when the same vendor_order_ref was seen before — the returned data is the original order and no duplicate was created. Use this to keep your retry loops idempotent.MA-2026-00042).id for logic, localized name for display. status mirrors order_status for backwards-compat.card, wallet, apple_pay, tamara.data.*.id fields for logic.Response schema
// 201 Created — new order (replayed = false)
// 200 OK — same vendor_order_ref re-sent (replayed = true, no duplicate created)
{
"status": true,
"replayed": <boolean>,
"data": {
"order_uuid": "0193b09d-9c8a-7af3-8b56-a51d6a3e4f10",
"order_number": "MA-2026-00042",
"vendor_order_ref": "VND-CART-9b3f12",
"state": "created",
"status": { "id": "created", "name": "Created" },
"order_status": { "id": "created", "name": "Created" },
"payment_status": { "id": "unpaid", "name": "Unpaid" },
"items": [
{ "sku": "pizza-pep-l", "name": "Pepperoni Pizza — Large", "qty": 2, "unit_price": 49.00 }
],
"subtotal": "98.00",
"delivery_fee": "10.00",
"tax_amount": "16.20",
"total_amount": "124.20",
"currency": "SAR",
"payment_method": null, // "card" | "wallet" | "apple_pay" | "tamara" once paid
"created_at": "2026-09-13T14:22:11.000Z",
"updated_at": "2026-09-13T14:22:11.000Z"
},
"message": "Order created"
}