Discounts
In Voyado Engage, vouchers and promotions are applied as discounts. This avoids having a customer be awarded points from a voucher that is used in a purchase. There are two kinds of discounts, line-item and total, and they work in similar ways.
Line-item discount
A line-item discount is applied directly to the specific line-item in the transaction. 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 discount
A total discount is applied across the whole transaction and is not recorded as its own separate line-item. Essentially, it is a series of line-item discounts. For example, a 30% total 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 (which is €10 in this case).
The preferred method
If you as a merchant 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
Both line-item and total discounts need to be applied before the transaction is sent. 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 Engage which discounts have been used. If an article is exposed to both a total 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 Engage.
An Engage instance needs to be configured to allow searching by discounts. Ask your Voyado team about this.
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 call to /receipts:
"usedBonusChecks": [ { "checkNumber": "2342" } ]
Redeeming promotions
A promotion is handled in the same way as a voucher. But if there is a promotion from Engage used in the transaction, this should be redeemed by a different API-call, and it should also be included in the usedPromotions array in the call to /receipts:
"usedPromotions": [ { "promotionId": "6374dfaa-31c5-4e34-bb88-7ccfc5fe8bf7" } ]