Skip to main content
Tell Lobyco which coupons a finished sale used, so they cannot be used again. Undo that when a sale is abandoned or the goods come back. The POS does this at the end of every sale that applied coupons, from either the Direct coupon service integration or the Discount integration.

Before you start

  • The POS has the memberId of the checked-in customer and the couponIds the sale applied, from whichever discount flow you use.
  • The POS has a receiptId for the sale before it redeems. The same value is the idempotency key, the receiptId in the redeem request and the receipt id on the recorded purchase. The offline path and the refund on a return both depend on them matching.

The flow

1

Redeem the coupons

POST /v2/customers/{customerId}/coupons/redeemCall this once the sale has completed. Send five things:
  • The Idempotency-Key header, set to the receiptId. It makes a retry safe, lets multi-use coupons count correctly, and is what a later refund refers to.
  • receiptId, the sale’s receipt id. Always send it. Lobyco needs it to give the coupons back itself when a return is recorded.
  • storeId, the store where the sale happened.
  • coupons, each with the value it granted.
  • basketValue, the basket total. Together with the store, it feeds the live statistics marketers see.
Lobyco redeems every coupon it finds. If some of the ids are unknown, it still redeems the rest and returns 400 Bad Request listing the ones it could not find.A redeemed coupon is one the response returns in its couponIds. Lobyco marks it as used and counts it against the offer’s redemption limits.
2

[Optional] Release the reservation

POST /api/v1/customers/{customerId}/coupons/cancel-reservationIf the sale is abandoned before you redeem, release the coupons that were reserved for it. The customer can then use them at another POS or online straight away. Send the couponIds and the same reservedBy the reservation was made with. A reservation made under a different reservedBy cannot be released this way. An unreleased reservation frees itself at its reservedUntil time.

Returns and refunds

When a customer returns goods, there are two ways to give the coupons back.

Cancel the redemption

POST /api/v1/customers/{customerId}/coupons/cancel-redeem When a customer returns goods, the POS can give the coupons back, so the customer can use them again while the offer is still valid. Send the Idempotency-Key the coupons were redeemed with and the coupon ids to return. Lobyco does not work out which coupons a return affects. The POS decides, and it sends one request per original redemption, because a request cancels redemptions under one key only.

Record the return

Where refunds are turned on, the POS can record the return as a purchase instead. Lobyco then works out which coupons the return completes, and gives them back. See Returns and refunds.

Offline redemption

Coupon retrieval and discount calculation need Lobyco online. Redemption does not. Sometimes the coupons were applied and the sale completed, but the POS cannot reach Lobyco to redeem them. Then put the coupon ids in the couponIds field of the purchase you send to POST /v1/purchases. Lobyco redeems them when it loads the purchase, with the purchase’s receiptId on each redemption, so a return can give them back. For this to work, the purchase’s receiptId must equal the Idempotency-Key you would have used in the redeem call. The matching key is how Lobyco recognises coupons that were already redeemed online, so it redeems nothing twice.

Failure and edge cases

If the redeem call does not go through, or the sale changes afterwards, it is one of these.
  • The redeem call times out. Retry with the same Idempotency-Key. Lobyco treats the retry as the same request and redeems nothing twice.
  • A coupon in the request is unknown. The response is 400 Bad Request with those ids, and the other coupons are redeemed. Log the ids. The sale itself is not affected.
  • The refund key does not match. A cancel-redeem under a different key than the redemption cancels nothing. Keep the receiptId with the sale, so a return days later can still find it.
  • The offer has ended. Cancel-redeem gives a coupon back only while its offer is still valid. After that, Lobyco does not return the coupon.

API reference

Endpoint documentation: Coupons (POS).
Last modified on October 29, 2026