# Basket pricing

> Preview: member, VIP and staff prices and usable rewards for a basket, returned as discounts.

Source: https://developers.loyx.se/preview/basket-pricing/

**Preview: this feature is planned and not live. The shape may change. Do not build against it yet.**

:::caution[Preview — not live, shape may change]
This feature is planned. Nothing on this page can be called yet.
:::

Send the basket, with or without a member. LoyX answers with the **price effects** that apply: member prices, VIP prices, staff prices, tier perks and rewards the member can use.

LoyX returns **discounts to apply**, never a repriced basket. Your till applies them with its own discount engine, because it owns VAT and the fiscal receipt.

## What comes back

| Effect | Meaning |
|---|---|
| `line_discount` | Take this amount off one line. Member, VIP and staff prices are always expressed this way. |
| `basket_discount` | An amount off the whole basket, already split across the lines, so tills that must book discounts per line can do so. |
| `free_item` | Make some units of a line free. |
| `info` | Text for the cashier or the receipt. |

Each effect says why it applies (`member_price`, `vip_price`, `staff_price`, `tier_perk`, `reward`, `offer`), carries a stable offer id and a short receipt text, and says whether it uses up a reward. A reward that is used up must be [held](/preview/hold-commit-release/) before you apply it.

The answer also lists rewards the member could use but did not pick, and every presented reward that was refused, with a reason and a cashier text.

## Rules

- Same input, same answer. Retrying is safe and cheap.
- Price effects first (the best single price per line), then rewards.
- LoyX never discounts more than the basket, and never discounts lines marked as gift cards, deposits, services or non-discountable.
- Local rules apply by store country, for example no discounts on alcohol in Swedish stores.
- Unknown effect types must be ignored.
- It is not a points quote, and it never reserves anything.

## Planned shape

```
POST /v1/baskets/price
{
  "context": { "store": { "external_store_id": "store12" }, "basket_id": "cart-991", "currency": "SEK" },
  "member_id": "...",
  "lines": [
    { "line_id": "1", "product": { "till_product_id": "SKU-1001" }, "quantity": { "value": 2, "unit": "ea" }, "unit_price_minor": 4500 }
  ]
}
```

The answer carries an `evaluation_id` to echo on the hold and on the sale, and a `valid_until` time.
