### Discounts

In Voyado, vouchers and promotions are applied as discounts. This avoids having a customer be awarded points when a voucher is used in a purchase. There are two kinds of discounts, line-item and total-receipt, and they work in similar ways.

#### Line-item discount

A line-item discount is applied directly to the specific line-item on the receipt. For example, if the discount is 25%, the price for that specific line-item will be the original price * 0.75. This new amount is then what the customer pays.

#### Total-receipt discount

A total-receipt discount is applied across the whole receipt and is not recorded as its own separate line-item. Essentially it is a series of line-item discounts. For example, a 30% total-receipt discount will result in the price of every line-item being multiplied by 0.70, and this new total is what the customer pays.

#### Example

If a customer makes a purchase containing multiple items for an amount of €15, and uses a voucher with a total discount value of €5, the price the customer pays is then €10. The discount from the voucher (€5) should be evenly spread out across all line-items, meaning the amount discounted on each line-item may vary.

In this example, the customer will only receive points on the amount paid by other payment methods besides the voucher (€10 in this case).

#### The preferred method

If you as a vendor are not able to make vouchers-as-discount configurable for every client, it is possible to do it other ways, but the preferred method is to always handle vouchers as a discount.

#### Applying a discount

Voyado requires both line-item and total-receipt discounts to be applied before the receipt is transmitted to Voyado. The grossPaidPrice should always describe the amount actually paid for the item, with all discounts already removed.

Regardless of the nature of the discount, item.discount can be used to tell Voyado which discounts have been used. If an article is exposed to both a total-receipt discount (for instance 20%) and a 100 SEK line-item discount, both of those will contribute to the total amount withdrawn from the original price.

For example, an article for 240 SEK will cost (240 * 0.80) – 100 = 92 SEK after both these discounts have been applied. These aggregated row values are stored as a parameter for searching the total discount per sold article in Voyado.

#### Redeeming vouchers

When a voucher is included in a purchase, it should be redeemed by a separate API call, and also be included in the usedBonusChecks array in the receipts call:

"usedBonusChecks": [
{
"checkNumber": "2342"
}
]

#### Redeeming promotions

A promotion is handled in the same way as a voucher. But if there is a promotion from Voyado used in the receipt, this should be redeemed by a different API-call, and it should also be included in the usedPromotions array in the receipts-call:

"usedPromotions": [
{
"promotionId": "6374dfaa-31c5-4e34-bb88-7ccfc5fe8bf7"
}
]