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

# Recommended refund

> Lobyco recommends what to pay back for each returned product, from what the customer paid on the original sale.

When the POS sends a customer's return to [POST /v1/discounted-purchases](https://help.lobyco.com/api-reference/promotion-platform/discounts/post-v1-discounted-purchases.md), Lobyco puts a recommended amount in each returned product's `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](https://help.lobyco.com/integration/pos-point-of-sale-integrations/returns-and-refunds).

> [!WARNING]
>
> A return cannot be priced together with a sale. If one request holds both returned products and products the customer is buying, the endpoint returns an error. Send the sale in a separate request.

## 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 `id` is 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](https://help.lobyco.com/integration/pos-point-of-sale-integrations/returns-and-refunds/coupon-refund.md#examples).

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

The 3 for 2 is taken off the line, so the customer paid 10.00 for 3 yoghurts.

| Return | Recommended |
| - | - |
| 1st visit: 1 yoghurt | 3.33. The 10.00 shared by 3, rounded down |
| 2nd visit: 2 yoghurts | 6.67. 3.33 for one, and the last one gets the 3.34 left |

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

```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. The first two lines cost 5.00 each, and the third cost nothing.

| Return | Recommended |
| - | - |
| 1st visit: 1 yoghurt | 5.00. It comes from a full-price line first |
| 2nd visit: 2 yoghurts | 5.00. 5.00 from the last full-price line, and 0.00 from the free one |

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](#the-same-multi-buy-on-separate-lines), with the yoghurts on separate lines. The customer brings them back one at a time, and the POS pays back nothing for the first.

| Return | Recommended | Paid back |
| - | - | - |
| 1st visit: 1 yoghurt | 5.00 | 0.00 |
| 2nd visit: 1 yoghurt | 10.00. The 5.00 not paid back on the 1st visit, and 5.00 for this one | 10.00 |
| 3rd visit: 1 yoghurt | 0.00. The customer has had back all 10.00 they paid | 0.00 |

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

```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
```

Each product carries a share of the basket discount: coffee 2.50, cheese 3.33 and wine 4.17.

| Return | Recommended |
| - | - |
| The coffee | 12.50. 15.00 less its 2.50 share |
| The cheese | 16.67. 20.00 less its 3.33 share |
| The wine | 20.83. 25.00 less its 4.17 share |

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

```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 coffee carries a 15.00 share of the discount and the milk 2.00. The cigarettes carry none.

| Return | Recommended |
| - | - |
| 1st visit: 2 coffees | 90.00. The coffee cost 135.00 for 3, so 45.00 each |
| 2nd visit: 1 coffee and 2 milks | 63.00. 45.00 for the coffee, and 9.00 for each milk |
| Any visit: the cigarettes | 80.00. They 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
```

In this sale the discount is split as 0.80 on the sandwich, 0.40 on the drink line and 0.30 on the crisps. It is taken off each line's `price`.

| Return | Recommended |
| - | - |
| 1st visit: the sandwich and 1 drink | 5.00. 3.20 for the sandwich, and 1.80 for the drink |
| 2nd visit: the crisps | 1.20 |
| 3rd visit: the other drink | 1.80. Both drinks share one line, so the full-price drink comes back at 1.80 too |

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

| Return | Recommended |
| - | - |
| The shampoo | 40.00. It had no discount |
| The conditioner | 0.00. It was free |

### 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 | Recommended |
| - | - |
| 1st visit: 2 coffees | 50.00. The line cost 100.00 for 4, so 25.00 each |
| 2nd visit: 2 coffees | 50.00 |

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](https://help.lobyco.com/api-reference/promotion-platform/discounts) and [Purchases](https://help.lobyco.com/api-reference/retail-master-data/purchases).

## Related

* [Returns and refunds](https://help.lobyco.com/integration/pos-point-of-sale-integrations/returns-and-refunds) — the flow that asks for the recommendation and records the return.
* [Coupon refund](https://help.lobyco.com/integration/pos-point-of-sale-integrations/returns-and-refunds/coupon-refund.md) — the same sales, followed through to the coupons.


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