curl --request POST \
--url https://{host}/pos-discount/v1/discounted-baskets \
--header 'Content-Type: application/json' \
--data '
{
"id": "3704a0d1-8cc7-40b2-b4b9-39fed8620798",
"storeId": "475",
"customer": {
"id": "12396909",
"barcode": "2900123969094"
},
"total": 27,
"lineItems": [
{
"id": "a8b0f5f9-245f-4bb0-a8eb-5b2cf5b6ed26",
"barcode": "5700123969094",
"quantity": 2,
"sequenceNumber": 1,
"totalSalePrice": 9,
"product": {
"id": "5700123969094",
"displayName": "Banana",
"categoryIds": [
"fruit"
],
"category": "Fruit",
"taxCode": "A",
"salePrice": 4.5,
"unitOfMeasure": "Piece"
}
},
{
"id": "53ec359f-0181-4d50-8fe4-21ea147d055c",
"barcode": "5700123969095",
"quantity": 3,
"sequenceNumber": 2,
"totalSalePrice": 18,
"product": {
"id": "5700123969095",
"displayName": "Orange",
"categoryIds": [
"fruit"
],
"category": "Fruit",
"taxCode": "A",
"salePrice": 6,
"unitOfMeasure": "Piece"
}
}
],
"discounts": [],
"coupons": []
}
'{
"id": "3704a0d1-8cc7-40b2-b4b9-39fed8620798",
"total": 27,
"finalTotal": 26.1,
"lineItems": [
{
"finalTotalSalePrice": 8.1,
"bonusTotalAmount": 0,
"id": "a8b0f5f9-245f-4bb0-a8eb-5b2cf5b6ed26",
"barcode": "5700123969094",
"quantity": 2,
"sequenceNumber": 1,
"totalSalePrice": 9,
"product": {
"id": "5700123969094",
"displayName": "Banana",
"categoryIds": [
"fruit"
],
"category": "Fruit",
"taxCode": "A",
"salePrice": 4.5,
"unitOfMeasure": "Piece"
},
"discounts": [
{
"id": "C:8f9640d2-b982-42ca-b6c5-a9696ad1d952",
"couponId": "9b7cbade-807d-4094-8592-fc894268f142",
"couponIds": [
"9b7cbade-807d-4094-8592-fc894268f142"
],
"description": "10% off bananas",
"fundedBy": "",
"value": 0.9,
"applicationsNumber": 2
}
],
"coupons": [
{
"couponId": "9b7cbade-807d-4094-8592-fc894268f142",
"sequenceNumber": 1,
"campaignId": "8f9640d2-b982-42ca-b6c5-a9696ad1d952",
"offerType": "appCoupon",
"expiryDate": "2026-12-06T12:20:14.9446488Z",
"dateToPickUp": "2026-12-06T12:20:14.9446488Z"
}
]
},
{
"finalTotalSalePrice": 18,
"bonusTotalAmount": 0,
"id": "53ec359f-0181-4d50-8fe4-21ea147d055c",
"barcode": "5700123969095",
"quantity": 3,
"sequenceNumber": 2,
"totalSalePrice": 18,
"product": {
"id": "5700123969095",
"displayName": "Orange",
"categoryIds": [
"fruit"
],
"category": "Fruit",
"taxCode": "A",
"salePrice": 6,
"unitOfMeasure": "Piece"
}
}
],
"discounts": [],
"bonuses": [],
"coupons": []
}Calculate discounts for a basket
The POS calls this with the basket as it stands, at subtotal or whenever it changes, and gets the same basket back with the discounts the customer’s coupons and offers grant. The customer is customer.id, the memberId the check-in gave the POS; a basket without a customer gets no discounts and comes back unchanged. New integrations should send the sale in the shape of a purchase to POST /v1/discounted-purchases instead: its request and response are the purchase the POS records afterwards.
Lobyco lists the customer’s coupons valid in storeId, applies the ones whose rules the basket meets in the order of the offers’ priority, and reserves the applied coupons under the basket’s id for a short time, 1 minute by default, so they cannot be used at another POS meanwhile. A coupon another basket holds a reservation on is not applied. Pass skipReservation=true to price a basket without reserving, for example one the customer has not committed to yet. purchaseTime evaluates the basket as of that time, to replay an earlier purchase as Lobyco’s bonus allocation does, and checkoutType keeps only the offers valid for that kind of checkout.
The response repeats the basket: each line with finalTotalSalePrice after its discounts and the discounts and coupons behind them, basket-level discounts and coupons beside the lines, and finalTotal for the whole basket. Discounts the POS applied itself, sent in discounts on the basket and on the lines, are taken into account, and are returned again only when preserveExternalDiscounts is on, by request or for your environment.
total must equal the sum of the lines’ totalSalePrice, with or without the basket-level discounts sent, and each line’s totalSalePrice must equal quantity times product.salePrice, plus any deposit, within 0.02. Otherwise the request is refused with 400 InvalidBasketCalculateDiscountRequest. Where Lobyco has turned this validation off for your environment, a line total that is off by more than 0.02 is recalculated instead.
A return basket gets a recommended refund for each returned line. A basket is a return when it has a customer and at least one line has an originalReceiptId, the receiptId of the sale the item was bought on. The recommended refund is what the customer paid for those units on the original sale, less what earlier returns of that sale already paid back. The response puts it in the line’s finalTotalSalePrice, as a negative amount, and finalTotal follows; totalSalePrice keeps what was sent. A line that is not on the original sale, or whose sale is not found, keeps the price that was sent. Every line of a return basket must have a totalSalePrice of zero or below, otherwise the request is refused with 400 InvalidReturnPurchase; the quantity can have either sign.
Nothing is stored. Record the finished sale with the Purchase API, and redeem the applied coupons with POST /v2/customers/{customerId}/coupons/redeem or through the purchase.
curl --request POST \
--url https://{host}/pos-discount/v1/discounted-baskets \
--header 'Content-Type: application/json' \
--data '
{
"id": "3704a0d1-8cc7-40b2-b4b9-39fed8620798",
"storeId": "475",
"customer": {
"id": "12396909",
"barcode": "2900123969094"
},
"total": 27,
"lineItems": [
{
"id": "a8b0f5f9-245f-4bb0-a8eb-5b2cf5b6ed26",
"barcode": "5700123969094",
"quantity": 2,
"sequenceNumber": 1,
"totalSalePrice": 9,
"product": {
"id": "5700123969094",
"displayName": "Banana",
"categoryIds": [
"fruit"
],
"category": "Fruit",
"taxCode": "A",
"salePrice": 4.5,
"unitOfMeasure": "Piece"
}
},
{
"id": "53ec359f-0181-4d50-8fe4-21ea147d055c",
"barcode": "5700123969095",
"quantity": 3,
"sequenceNumber": 2,
"totalSalePrice": 18,
"product": {
"id": "5700123969095",
"displayName": "Orange",
"categoryIds": [
"fruit"
],
"category": "Fruit",
"taxCode": "A",
"salePrice": 6,
"unitOfMeasure": "Piece"
}
}
],
"discounts": [],
"coupons": []
}
'{
"id": "3704a0d1-8cc7-40b2-b4b9-39fed8620798",
"total": 27,
"finalTotal": 26.1,
"lineItems": [
{
"finalTotalSalePrice": 8.1,
"bonusTotalAmount": 0,
"id": "a8b0f5f9-245f-4bb0-a8eb-5b2cf5b6ed26",
"barcode": "5700123969094",
"quantity": 2,
"sequenceNumber": 1,
"totalSalePrice": 9,
"product": {
"id": "5700123969094",
"displayName": "Banana",
"categoryIds": [
"fruit"
],
"category": "Fruit",
"taxCode": "A",
"salePrice": 4.5,
"unitOfMeasure": "Piece"
},
"discounts": [
{
"id": "C:8f9640d2-b982-42ca-b6c5-a9696ad1d952",
"couponId": "9b7cbade-807d-4094-8592-fc894268f142",
"couponIds": [
"9b7cbade-807d-4094-8592-fc894268f142"
],
"description": "10% off bananas",
"fundedBy": "",
"value": 0.9,
"applicationsNumber": 2
}
],
"coupons": [
{
"couponId": "9b7cbade-807d-4094-8592-fc894268f142",
"sequenceNumber": 1,
"campaignId": "8f9640d2-b982-42ca-b6c5-a9696ad1d952",
"offerType": "appCoupon",
"expiryDate": "2026-12-06T12:20:14.9446488Z",
"dateToPickUp": "2026-12-06T12:20:14.9446488Z"
}
]
},
{
"finalTotalSalePrice": 18,
"bonusTotalAmount": 0,
"id": "53ec359f-0181-4d50-8fe4-21ea147d055c",
"barcode": "5700123969095",
"quantity": 3,
"sequenceNumber": 2,
"totalSalePrice": 18,
"product": {
"id": "5700123969095",
"displayName": "Orange",
"categoryIds": [
"fruit"
],
"category": "Fruit",
"taxCode": "A",
"salePrice": 6,
"unitOfMeasure": "Piece"
}
}
],
"discounts": [],
"bonuses": [],
"coupons": []
}Query Parameters
Only apply offers granting these benefits: Discount, Bonus or both. Repeat the parameter for several. Omitted, both.
What an offer gives the customer at checkout.
Discount: a lower price, taken off the line or the basket total.Bonus: loyalty bonus, granted on top of the price.
This list is not final. Lobyco may add a value at any time, and a consumer must not fail on a value it does not know.
Discount, Bonus Body
The basket as it stands.
The basket as it stands, to calculate discounts for.
Response
The basket with the discounts applied: finalTotal, each line's finalTotalSalePrice, and the discounts and coupons behind them. A basket with no applicable discounts comes back unchanged.
The basket with the discounts Lobyco applied: the final totals, and the discounts and coupons behind them.