Record a sale
post
https://api.flactrum.com/v1/orders
Runs the full POS path: branch price override, running campaign, recipe cost, stock deduction, customer balance and points, and the order webhooks. There is deliberately no separate "API sale" shortcut — two paths would produce two different sets of numbers.
| Required scope | orders.write |
| Panel screen | POS — Sales |
| Success status | 201 |
| Returns | One Order object |
Request body
| Field | Type | Description |
|---|---|---|
| branch_id * | string | — |
| lines * | array | Each entry is {product_id, quantity, addon_ids?}. |
| payment_method_id | string|null | Required whenever an amount is left to pay after balance and points: a sale without a method cannot be reconciled at day end and is rejected with 409. Not needed when balance/points cover the whole total. From a kiosk this records the customer's choice without collecting the money. |
| discount | number | Manual discount on the gross total, on top of any campaign. |
| channel | string | — |
| customer_id | string|null | — |
| balance_to_use | number | Requires customer_id. |
| points_to_use | integer | Requires customer_id. Capped by the loyalty rules. |
| customer_name | string|null | Name to call the order by, at most 80 characters. |
| kiosk_device_id | string | Sent by a POS device relaying a kiosk order from the same local network. The order is recorded as that kiosk order (channel kiosk, awaiting payment at the counter). The kiosk must be paired with the same branch; otherwise 409. |
| ticket_number | string | The local number the customer was given while the till was offline (e.g. K-012). Every screen then shows this number for the order. |
| note | string|null | — |
| coupon_code | string | A coupon the customer entered. The server prices the cart, checks the coupon (dates, branch, minimum total, usage limits) and applies its discount after campaigns. Cannot be combined with `discount`. An unusable coupon returns 409 with `details.reason = coupon` and `details.coupon_reason`. |
| card_payment | object | Kiosk only: a card payment already taken on the kiosk's own payment terminal. The order is recorded as paid with `payment_method_id` instead of awaiting payment at the counter. `amount` must equal the order total the server computes; otherwise 409 `amount_mismatch` and nothing is recorded, so the kiosk can void the terminal transaction. |
Response fields
| Field | Type | Description |
|---|---|---|
| id | string | — |
| order_number | string | — |
| branch_id | string | — |
| channel | string | Where the sale came from. |
| status | string | Payment lifecycle. A kiosk order paid at the counter stays `pending` until POST /orders/{order}/pay. |
| display_number | string | Short daily number called out to the customer, e.g. 007. |
| kitchen | object | Kitchen stage: `status` is new, preparing, ready, delivered or null (never goes to the kitchen), with the time each stage was reached. |
| customer_id | string|null | — |
| customer_name | string|null | Free text typed at the kiosk so staff can call the order by name. Unrelated to customer_id, which is a registered loyalty customer. |
| payment_method_id | string|null | On a kiosk order this is the method the customer chose; the money is still collected at the counter, so the order stays `pending` until POST /orders/{order}/pay. |
| totals | object | total, subtotal, tax, discount, campaign_discount, cost, gross_profit. |
| customer_payment | object | How much was covered by balance and points, and what was earned. |
| items | array | Prices are frozen at sale time; later menu or campaign changes never alter a past receipt. A line refunded later is split off with `cancelled_at` set and no longer counts toward the totals. |
| payments | array | How the money was collected, one entry per method. A split bill (several methods) has several entries; balance and points are in customer_payment. |
| adjustments | array | Refunds and waste recorded after the sale, oldest first. |
| note | string|null | — |
| ordered_at | string | — |
Examples
Recorded from the test suite — these are real requests and their real responses.
curl -X POST 'https://api.flactrum.com/v1/orders' \
-H 'Authorization: Bearer flk_your_key:your_secret' \
-H 'Content-Type: application/json' \
-d '{
"branch_id": "01m43sk86r19txx8nzyx46h86k",
"payment_method_id": "01m43sk87gxe64jm0mk2vx2sd7",
"lines": [
{
"product_id": "01m43sk87853hg4h83vg4rnw2j",
"quantity": 2
}
],
"channel": "mobil"
}'
HTTP 201 · application/json
{
"data": {
"id": "01m43sk88dzv6z5r8wy4171rr3",
"order_number": "NIS-261004-0001",
"branch_id": "01m43sk86r19txx8nzyx46h86k",
"channel": "mobil",
"service_type": "counter",
"table": null,
"status": "completed",
"display_number": "001",
"kitchen": {
"status": "new",
"preparing_at": null,
"ready_at": null,
"delivered_at": null
},
"customer_id": null,
"customer_name": null,
"payment_method_id": "01m43sk87gxe64jm0mk2vx2sd7",
"totals": {
"total": 200,
"subtotal": 181.82,
"tax": 18.18,
"discount": 0,
"campaign_discount": 0,
"cost": 0,
"gross_profit": 181.82
},
"customer_payment": {
"paid_with_balance": null,
"paid_with_points": null,
"points_spent": 0,
"points_earned": 0
},
"items": [
{
"id": "01m43sk88nrtam2ktf6jz8g819",
"product_id": "01m43sk87853hg4h83vg4rnw2j",
"campaign_id": null,
"quantity": 2,
"unit_price": 100,
"list_price": 100,
"campaign_discount": 0,
"total_price": 200,
"tax_rate": 10,
"tax_amount": 18.18,
"cancelled_at": null,
"cancel_reason": null,
"addons": []
}
],
"payments": [
{
"payment_method_id": "01m43sk87gxe64jm0mk2vx2sd7",
"name": "Nakit",
"type": "cash",
"amount": 200,
"reference": null
}
],
"adjustments": [],
"note": null,
"ordered_at": "2026-10-04T15:47:51+00:00",
"paid_at": "2026-10-04T15:47:51+00:00",
"created_at": "2026-10-04T15:47:51+00:00",
"updated_at": "2026-10-04T15:47:51+00:00"
}
}
curl -X POST 'https://api.flactrum.com/v1/orders' \
-H 'Authorization: Bearer flk_your_key:your_secret' \
-H 'Content-Type: application/json' \
-d '{
"payment_method_id": "01m43sk8zr1s79rc1ndh31yetz",
"branch_id": "01m43sk8yw23vpqvhq2cn5wzt6",
"lines": [
{
"product_id": "01m43sk8zgttpcde068esrncy5",
"quantity": 1
}
],
"balance_to_use": 50
}'
HTTP 409 · application/json
{
"error": {
"code": "conflict",
"message": "Paying with balance or points requires customer_id."
}
}