> ## Documentation Index
> Fetch the complete documentation index at: https://help.lobyco.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Coupon refund

> Lobyco gives a coupon back once the customer has returned everything it discounted. A partial return leaves it used.

After the POS records a customer's return, Lobyco looks up the coupons redeemed on each original receipt. A coupon comes back once every product it discounted has been returned in full. Until then the customer keeps the discount on what they kept, and the coupon stays used. The flow is on [Returns and refunds](https://help.lobyco.com/integration/pos-point-of-sale-integrations/returns-and-refunds).

## What counts as returned

* **Products with an allocation for the coupon's discount.** For each discount on the sale with `couponIds`, Lobyco takes the products with an entry for it in `discountAllocations`. It does not use `appliedProducts`, because that is empty for a basket discount. A product the discount excluded, or one that only helped reach a threshold, has no allocation. The customer can keep it.
* **Every unit of the product, on every line.** Lobyco matches returned products to the sale by `id`, not by line. So every unit of that `id` on the sale must come back, including units on lines without the allocation.
* **Over all the returns of the sale.** Lobyco records every return of a sale, so returns add up. A sale of 3 can come back as 2 and then 1.
* **Quantities only.** Lobyco ignores refund amounts. Lines with `isCancelled: true` are netted out of the quantities.

## When a coupon comes back

* **On the receipt it was redeemed on.** Lobyco matches a return to the coupons redeemed with the `receiptId` that the returned products give as `originalReceiptId`.
* **Together with the other coupons of its discount.** Coupons of one offer used on a sale are one discount with several `couponIds`. Lobyco cannot tell which unit each covered, so they come back together.
* **Even after it has expired.** Lobyco cancels the redemption and restores the coupon's usage and the offer's limits. An expired coupon still cannot be used.

## Examples

Each example is one sale, `SALE-1`, and what happens to its coupon as the customer brings items back.

### A multi-buy returned in two visits

```text theme={"system"}
SALE-1
Yoghurt            3 x 5.00      15.00
  3 for 2 coupon                 -5.00
Total                            10.00
```

| Return | Coupon |
| - | - |
| 1st visit: 1 yoghurt | Still used. 2 of the 3 yoghurts are still with the customer |
| 2nd visit: 2 yoghurts | Back. All 3 yoghurts are back |

### The same multi-buy on separate lines

```text theme={"system"}
SALE-1
Yoghurt            1 x 5.00       5.00
Yoghurt            1 x 5.00       5.00
Yoghurt            1 x 5.00       5.00
  3 for 2 coupon                 -5.00
Total                            10.00
```

The discount sits on the third line only. Lobyco matches returns by `id`, not by line, so all 3 yoghurts still count.

| Return | Coupon |
| - | - |
| 1st visit: 1 yoghurt | Still used, whichever yoghurt it is. Lobyco cannot tell the free one from the others |
| 2nd visit: 2 yoghurts | Back. All 3 yoghurts are back |

### A basket coupon

```text theme={"system"}
SALE-1
Coffee             1 x 15.00     15.00
Cheese             1 x 20.00     20.00
Wine               1 x 25.00     25.00

Subtotal                         60.00
Spend 50, get 10 off coupon     -10.00
Total                            50.00
```

| Return | Coupon |
| - | - |
| 1st visit: the coffee | Still used. The cheese and the wine still carry the discount |
| 2nd visit: the cheese and the wine | Back. Everything the coupon discounted is back |

### A product the coupon excludes

The coupon is "10% off when you spend 100 or more, tobacco excluded".

```text theme={"system"}
SALE-1
Coffee             3 x 50.00    150.00
Milk               2 x 10.00     20.00
Cigarettes         1 x 80.00     80.00

Subtotal                        250.00
10% off from 100 coupon         -17.00
Total                           233.00
```

The discount is shared between the coffee and the milk. The cigarettes are excluded, so they do not count.

| Return | Coupon |
| - | - |
| 1st visit: 2 coffees | Still used. 1 coffee and 2 milks are still with the customer |
| 2nd visit: 1 coffee and 2 milks | Back. The customer keeps the cigarettes, which had no discount |

### 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.

```text theme={"system"}
SALE-1
Sandwich           1 x 4.00       4.00
Drink              2 x 2.00       4.00
Crisps             1 x 1.50       1.50

Subtotal                          9.50
Meal deal coupon                 -1.50
Total                             8.00
```

The discount is shared between the sandwich, the drink line and the crisps. Both drinks count, because Lobyco matches returns by `id`, not by unit.

| Return | Coupon |
| - | - |
| 1st visit: the sandwich and 1 drink | Still used. The crisps and 1 drink are still with the customer |
| 2nd visit: the crisps | Still used. 1 drink is still with the customer. Lobyco cannot tell it was the full-price one |
| 3rd visit: the other drink | Back. Everything the coupon discounted is back |

### Buy one, get one free

```text theme={"system"}
SALE-1
Shampoo            1 x 40.00     40.00
Conditioner        1 x 30.00     30.00
  Conditioner free coupon       -30.00
Total                            40.00
```

Only the conditioner carries the discount. The two rows are alternatives:

| Return | Coupon |
| - | - |
| The shampoo only | Still used. The customer kept the free conditioner |
| The conditioner only | Back. Nothing with the discount is left |

### Two coupons of the same offer

```text theme={"system"}
SALE-1
Coffee             4 x 50.00    200.00
  1 coffee free (coupon A)      -50.00
  1 coffee free (coupon B)      -50.00
Total                           100.00
```

| Return | Coupons |
| - | - |
| 1st visit: 2 coffees | Both still used |
| 2nd visit: 2 coffees | Both back. Lobyco cannot tell which coffees were free, so A and B come back together |

## API reference

Endpoint documentation: [Purchases](https://help.lobyco.com/api-reference/retail-master-data/purchases) and [Coupons (POS)](https://help.lobyco.com/api-reference/promotion-platform/coupons-pos).

## Related

* [Returns and refunds](https://help.lobyco.com/integration/pos-point-of-sale-integrations/returns-and-refunds) — the flow that records the return this page acts on.
* [Coupon redemption at POS](https://help.lobyco.com/integration/pos-point-of-sale-integrations/coupon-redemption-at-pos.md) — the redeem call that carries the `receiptId`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.