Orders
An order goes through Lynked the way it goes through a POS: first Lynked works out the discounts, then, once the customer has paid, it applies the rewards.
Before the first order#
Every order is made at a seller — a till, a POS or a seller app login of the business. Get their
ids with GET /sellers and pass one as seller_id; the order
belongs to that seller's location.
1. Discounts: create the order#
POST /orders with the seller, the customer's barcode, your
order id and the cart. Lynked identifies the customer by the barcode exactly as a POS does (the
Lynked barcode, a voucher code, a staff barcode, a phone or an email) and answers with the order
in progress with its discounts. You get order.created.
Lynked gives two kinds of discount, and they are separate:
| Field | What it is |
|---|---|
discount | A discount on the order as a whole, for example a value voucher. It is not split over the lines. |
items[].discount | A discount on that line only, for example a stamp voucher or a product discount. |
The order's discount does not include the line discounts, and the line discounts are not a share
of it. The customer pays total − discount − the sum of items[].discount.
Each discount comes with its reasons — discount_reasons on the order and on every line: the type
(a voucher, a stamp voucher, a product discount, a staff discount…), the amount and a short
description.
The cart changed? Send POST /orders again with the same external_order_id and the whole new
cart: the same order is repriced (no second order.created).
2. Rewards: complete the order#
After payment, POST /orders/{id}/complete — no body. The
order is completed with the cart and discounts Lynked returned last: vouchers it used are marked
used, and the customer gets the rewards: points, stamps, vouchers. Each reward is listed where it
was given — rewards on the order and on every line — with its type, value and a short
description. You get order.completed and customer.rewards_updated.
Complete and cancel work only on orders created through this API (409 order_not_from_api
otherwise): an order in progress at a POS is finished by that POS.
Canceling#
Only an order in progress can be canceled:
POST /orders/{id}/cancel. Nothing was applied yet, so
nothing is taken back. Lynked also cancels an order left in progress for 15 minutes. A completed
order is never canceled. You get order.canceled either way.
Order ids#
external_order_id names one order in progress. Once that order is completed or canceled, the
same external_order_id starts a new order. To retry a request safely, send an
Idempotency-Key.
The customer is not notified#
Lynked sends the customer no email or push about an order made through this API. Tell the customer yourself; the webhooks tell you what changed.
Reading orders#
GET /orders lists the orders of the business from every
channel — POS, seller app, online shop and this API — with channel telling them apart;
GET /orders/{id} returns one.