price. It is what the customer paid for those units, less what earlier returns already paid back. The discount stays with the items the customer keeps. The POS can pay back that amount or a different one. The flow is on Returns and refunds.
What the customer paid
Lobyco starts from the original sale, as the POS recorded it.- A product-level discount is already taken off the product’s
price. - A basket discount is not. Each product’s share of it is in
discountAllocations. - What the customer paid for a line is its
price, less its share of any basket discount. - A cancelled line (
isCancelled: true) is netted out against the product’s other lines.
How the amount is split
- Full-price lines first. When the same
idis on several lines, returned units come from lines without a discount first. - Equal shares within a line. Units on one line share what is left on it, rounded down to the cent.
- The last unit gets the rest. Rounding never loses or adds a cent.
- Returns add up. Each recommendation counts the earlier returns of the sale, at the amount the POS actually paid back.
- What was not paid back moves on. Lobyco assumes the units the customer paid for come back first. If the POS paid back less than recommended, the rest goes to the next units that come back.
- Never more than was paid. If the POS paid back more than recommended, the next units are recommended at less, down to 0.00.
Examples
Each example is one sale,SALE-1, and what Lobyco recommends as the customer brings items back. The same sales are followed through to the coupons on Coupon refund.
A multi-buy returned in two visits
If the POS pays back 5.00 for the first yoghurt instead, the other two are recommended at 2.50 each. The refunds still add up to the 10.00 the customer paid.
The same multi-buy on separate lines
The first refund is 5.00 here, against 3.33 when the yoghurts are on one line. Lobyco keeps each line’s own price and does not merge lines.
Paying back less than recommended
The sale is the one from the previous example, with the yoghurts on separate lines. The customer brings them back one at a time, and the POS pays back nothing for the first.
Lobyco assumes the first yoghurt back was one the customer paid for, so the 5.00 the POS kept back moves to the next one. A cashier may expect 5.00 for the second yoghurt. If the POS pays back 5.00 instead, the last yoghurt is recommended at 5.00. Either way, the refunds add up to the 10.00 the customer paid.
A basket coupon
Once the coffee is back, the basket is below 50. The customer keeps the discount on the cheese and the wine anyway.
A product the coupon excludes
The coupon is “10% off when you spend 100 or more, tobacco excluded”.A Mix & Match meal deal
The coupon is a meal deal: “a sandwich, a drink and crisps for 6.00”. The customer also buys a second drink at full price.price.
Buy one, get one free
Two coupons of the same offer
If each coffee were on its own line, the two full-price coffees would come back first, at 50.00 each. The two free ones would follow at 0.00.
API reference
Endpoint documentation: Discounts and Purchases.Related
- Returns and refunds — the flow that asks for the recommendation and records the return.
- Coupon refund — the same sales, followed through to the coupons.