# Discounts This page provides information on deducting discounts through Kustom Checkout (KCO), including vouchers, codes, gift cards, and loyalty clubs, along with integration and VAT handling. ## Discount voucher or code A discount code or voucher offers a price reduction (percentage or absolute value). VAT is calculated based on the discounted price. KCO supports value-based and percentage discounts, applicable to individual items or entire orders. Currently, KCO doesn't offer a UI for discount application; it's applied to order lines. Percentage discounts are handled either as a `total_discount_amount` or as separate order lines with negative amounts. The formula for calculating tax amounts is: `total_amount` - `total_amount` * 10000 / (10000 + `tax_rate`). ### Example of a discount per order line A white t-shirt is discounted 20% with a 25% tax rate. ```json { ... "name": "white t-shirt", "quantity": 1, "reference": "12-345-ABC", "tax_rate": 2500, "total_amount": 25000, "total_discount_amount": 5000, "total_tax_amount": 5000, "type": "physical", "unit_price": 30000 } ``` ### Example of a fixed $10 discount A $10 discount is applied as a separate order line. ```json { ... "name": "10 USD discount", "quantity": 1, "reference": "12-345-ABC-discount", "tax_rate": 2500, "total_amount": -1000, "total_tax_amount": -200, "type": "physical", "unit_price": -1000 } ``` ### Example of a buy-2-for-3 deal A buy-2-for-3 discount is applied. ```json { ... "name": "buy 2 for 3 discount", "quantity": 1, "reference": "buy 2 get 3-discount", "tax_rate": 2500, "total_amount": - {3\*item price - 2\*item}, "total_tax_amount": - {total_amount\*0.2), "type": "discount", "unit_price": -{3\*item price - 2\*item} } ``` ## Gift cards Gift cards are multi-purpose vouchers with a predefined face value. No VAT is triggered upon the gift card purchase; VAT is applied only when the gift card is redeemed. Redemption should be handled as a negative order line with a 0% VAT. ```json { "name": "Gift Card:", "quantity": 1, "unit_price": -10000, "tax_rate": 0, "total_amount": -10000, "total_tax_amount": 0, "reference": "voucher", "type": "gift_card" } ``` ## Loyalty clubs Loyalty schemes and points are handled on a case-by-case basis. Bonus checks should be handled similarly to vouchers. ## Store credit Store credit for returned items should be treated as a gift card, a new negative order line with 0% VAT. Only subsequent purchases trigger VAT.