This page explains how best to send Ravelin data about discounts.
Many of our clients use different types of discounts in relation to the products they sell. This information is intended to to help guide you on how best to represent this information in Ravelin. There are 2 different ways you can share this information with us.
Regardless of how you implement discounts, the guiding principle here should be that the order price sent to Ravelin via the API should match what the customer spent on the order.
The main difference in how you choose to send this is then whether or not you have access to the cost of an item before a discount was applied.
If the cost of the item before the discount is applied is known, please send Ravelin the item price before any discount was applied, for all items in the order. Ideally, the discount should be represented by a single extra item with a negative item price.
If there are multiple items in the order which have a discount applied, please sum the total of all discounts and set that in the item price. If you do not wish to sum all the items discounts and would prefer to see an extra item for each discount, then this is also an option. This approach also works for general promotions (e.g. 10% off the whole order).
Do not include item.sku
on any item that represents a discount.
If the cost of the item before the discount is applied is not known, please send Ravelin the item price with the discount applied.
The impact of choosing this option instead of option A is that you will not be able to visualise the use of discounts within the order view in Ravelin or target any related behaviour.
There are some other things to keep in mind when sending discount related data.
"price": 0
and include
item.sku
.The below shows an example of the kind of text that should appear in the body of your API requests to Ravelin. The below does not represent a complete request body.
{
"items": [
{
"sku": "item1",
"quantity": 2,
"name": "Normal item being purchased",
"price": 1000,
"currency": "GBP"
},
{
"quantity": 1,
"name": "Total Discount",
"price": -500,
"currency": "GBP"
},
{
"sku": "freeitem",
"quantity": 1,
"name": "Free promotional item",
"price": 0,
"currency": "GBP"
}
]
}
Was this page helpful?