Discount Examples
This page provides API examples of common discounts
- Spend £20 get 20% off order
- Spend £100 get £10 off order
- Buy 4 get 1 free
- Get 10% off with promotion code
- Spend more than £100/$200/€150 of basket total to get free shipping
- Spend £100 get a specific category of products free
- Spend £100 get a specific product free
- Return content (e.g. banner)
- Spend £75, If VIP customer, get 20% off order
- Spend £75, If VIP customer, get 20% off order, Otherwise get 10% off order
Spend £20 get 20% off order
Add items to the basket to a value of £20. All basket items contribute to the total of £20 - there is no line item filter. After evaluation the basket receives 20% off the total with no conditions.
Create discount JSON
{
"name": "Spend 20 get 20% off",
"start": null,
"end": null,
"conditions": [
{
"eligibilityExpression": null,
"lineItemFilter": null,
"lineItemGroupCondition": {
"type": "MinimumSpend",
"values": [
{
"currencyCode": "GBP",
"value": 20
}
]
}
}
],
"actions": [
{
"type": "AmountOffBasket",
"amountOffType": "PercentOff",
"values": [
{
"condition": null,
"value": 20
}
]
}
]
}
Processor API example
Request JSON
{
"basket": {
"items": [
{
"price": 49.99,
"quantity": 2
}
]
},
"context": {
"currencyCode": "GBP"
},
"settings": {
"dataInstance": "Staging",
"explain": false,
"commit": false
}
}
Response JSON
{
"actions": [
{
"id": "32d1522c-30b2-433b-b817-2f327493793a",
"discountId": "33a6eaef-1dc1-42b0-8f0d-211bfa7ec244",
"type": "AmountOffBasket",
"qualifiedCouponCode": null,
"amountOffType": "PercentOff",
"value": 20,
"amountOff": 20,
"displayMessages": []
}
],
"basket": {
"total": 79.98,
"totalAmountOff": 20,
"items": [
{
"total": 79.98,
"totalAmountOff": 20,
"actions": [
{
"id": "32d1522c-30b2-433b-b817-2f327493793a",
"subItemId": 1,
"amountOff": 10
},
{
"id": "32d1522c-30b2-433b-b817-2f327493793a",
"subItemId": 2,
"amountOff": 10
}
]
}
]
},
"aggregates": {
"total": 79.98,
"totalAmountOff": 20
},
"commitId": null
}
Spend £100 get £10 off order
Add items to the basket to a value of £100. All basket items contribute to the total of £100 - there is no line item filter. After evaluation the basket receives an action of £10 off the total of the basket with no conditions.
Create discount JSON
{
"name": "Spend 100 get 10 off",
"start": null,
"end": null,
"conditions": [
{
"eligibilityExpression": null,
"lineItemFilter": null,
"lineItemGroupCondition": {
"type": "MinimumSpend",
"values": [
{
"currencyCode": "GBP",
"value": 100
}
]
}
}
],
"actions": [
{
"type": "AmountOffBasket",
"amountOffType": "AmountOff",
"values": [
{
"condition": null,
"value": [
{
"currencyCode": "GBP",
"value": 10.0
}
]
}
]
}
]
}
Processor API example
Request JSON
{
"basket": {
"items": [
{
"price": 59.99,
"quantity": 2
}
]
},
"context": {
"currencyCode": "GBP"
},
"settings": {
"dataInstance": "Staging",
"explain": false,
"commit": false
}
}
Response JSON
{
"actions": [
{
"id": "1a587c29-1e7a-4835-bd55-69f9f87eba54",
"discountId": "81918dc0-d172-4144-b557-cdad06663f66",
"type": "AmountOffBasket",
"qualifiedCouponCode": null,
"amountOffType": "AmountOff",
"value": 10,
"amountOff": 10,
"displayMessages": []
}
],
"basket": {
"total": 119.98,
"totalAmountOff": 10,
"items": [
{
"total": 119.98,
"totalAmountOff": 10,
"actions": [
{
"id": "1a587c29-1e7a-4835-bd55-69f9f87eba54",
"subItemId": 1,
"amountOff": 5
},
{
"id": "1a587c29-1e7a-4835-bd55-69f9f87eba54",
"subItemId": 2,
"amountOff": 5
}
]
}
]
},
"aggregates": {
"total": 119.98,
"totalAmountOff": 10
},
"commitId": null
}
Buy 4 get 1 free
Add 4 items to the basket. After evaluation 1 line item receives an action of 100% off.
Create discount JSON
{
"name": "Buy 4 get 1 free",
"start": null,
"end": null,
"conditions": [
{
"eligibilityExpression": null,
"lineItemFilter": null,
"lineItemGroupCondition": {
"type": "MinimumQuantity",
"quantity": 4
}
}
],
"actions": [
{
"maxItemsPerApplication": 1,
"lineItemFilter": null,
"type": "AmountOffLineItem",
"maxApplications": 1,
"amountOffType": "PercentOff",
"values": [
{
"condition": null,
"value": 100
}
]
}
]
}
Processor API example
Request JSON
{
"basket": {
"items": [
{
"price": 29.99,
"quantity": 4
}
]
},
"context": {
"currencyCode": "GBP"
},
"settings": {
"dataInstance": "Staging",
"explain": false,
"commit": false
}
}
Response JSON
{
"actions": [
{
"id": "eef04de9-2a92-4d32-8af3-57089da3c679",
"discountId": "0609a5f0-9996-49e0-9126-b0a2b320dd08",
"type": "AmountOffLineItem",
"qualifiedCouponCode": null,
"amountOffType": "PercentOff",
"value": 100,
"amountOff": 29.99,
"displayMessages": []
}
],
"basket": {
"total": 89.97,
"totalAmountOff": 29.99,
"items": [
{
"total": 89.97,
"totalAmountOff": 29.99,
"actions": [
{
"id": "eef04de9-2a92-4d32-8af3-57089da3c679",
"subItemId": 1,
"amountOff": 29.99
}
]
}
]
},
"aggregates": {
"total": 89.97,
"totalAmountOff": 29.99
},
"commitId": null
}
Get 10% off one item with promotion code
Requires an existing coupon group with valid coupon codes. See Coupon Codes for an overview of coupon codes. Add at least one line item to the basket to qualify. Requires an unused coupon code attached to the coupon group specified. After evaluation one basket line item will receive a 10% off discount action.
Create discount JSON
{
"name": "Coupon code get 10% off",
"start": null,
"end": null,
"conditions": [
{
"eligibilityExpression": null,
"lineItemFilter": null,
"lineItemGroupCondition": {
"type": "MinimumQuantity",
"quantity": 1
},
"couponGroupId": "b5a6bc63-11a1-4a7c-82b6-d705871f4b3f"
}
],
"actions": [
{
"maxItemsPerApplication": 1,
"type": "AmountOffLineItem",
"maxApplications": 1,
"amountOffType": "PercentOff",
"values": [
{
"condition": null,
"value": 10
}
]
}
]
}
Processor API example
Request JSON
{
"basket": {
"items": [
{
"price": 29.99,
"quantity": 4
}
]
},
"context": {
"currencyCode": "GBP"
},
"settings": {
"dataInstance": "Staging",
"explain": false,
"commit": false
},
"couponCodes": [
{
"code": "MJ62KTKSFX"
}
]
}
Response JSON
{
"actions": [
{
"type": "CouponCodeAccepted",
"id": "5ae0dcbf-17e8-48b2-9fbf-fdb109efa8bc",
"code": "MJ62KTKSFX"
},
{
"id": "dfa00963-08b0-449f-9a05-a69b51caea07",
"discountId": "1cd643f3-1773-403a-8492-ca36f9be8bb2",
"type": "AmountOffLineItem",
"qualifiedCouponCode": "MJ62KTKSFX",
"amountOffType": "PercentOff",
"value": 10,
"amountOff": 3,
"displayMessages": []
}
],
"basket": {
"total": 116.96,
"totalAmountOff": 3,
"items": [
{
"total": 116.96,
"totalAmountOff": 3,
"actions": [
{
"id": "dfa00963-08b0-449f-9a05-a69b51caea07",
"subItemId": 1,
"amountOff": 3
}
]
}
]
},
"aggregates": {
"total": 116.96,
"totalAmountOff": 3
},
"commitId": null
}
Spend more than £100/$200/€150 of basket total to get free shipping
Add items to the basket with total value greater than either £100, €150 or $200. The basket currency must be set during evaluation - e.g. “GBP”, “USD”, “EUR”. A cost named “Shipping” should exist on the evaluation request costs collection. After evaluation the cost “Shipping” will receive 100%.
Create discount JSON
{
"name": "Spend £100/$200/€150 get free shipping",
"start": null,
"end": null,
"conditions": [
{
"eligibilityExpression": null,
"lineItemFilter": null,
"lineItemGroupCondition": {
"type": "MinimumSpend",
"values": [
{
"currencyCode": "GBP",
"value": 100
},
{
"currencyCode": "EUR",
"value": 150
},
{
"currencyCode": "USD",
"value": 200
}
]
}
}
],
"actions": [
{
"type": "AmountOffCost",
"name": "Shipping",
"amountOffType": "PercentOff",
"values": [
{
"condition": null,
"value": 100
}
]
}
]
}
Processor API example
Request JSON
{
"basket": {
"items": [
{
"price": 29.99,
"quantity": 4
},
{
"price": 50.99,
"quantity": 2
}
]
},
"context": {
"currencyCode": "EUR"
},
"settings": {
"dataInstance": "Staging",
"explain": false,
"commit": false
},
"costs": [
{
"name": "Shipping",
"value": 10
}
]
}
Response JSON
{
"actions": [
{
"id": "ba9f8003-2b41-42e2-a889-cf876aa68233",
"discountId": "98e962df-460a-43ff-b9aa-2b1135de77e6",
"type": "AmountOffCost",
"qualifiedCouponCode": null,
"amountOffType": "PercentOff",
"value": 100,
"amountOff": 10,
"displayMessages": []
}
],
"basket": {
"total": 221.94,
"totalAmountOff": 0,
"items": [
{
"total": 119.96,
"totalAmountOff": 0,
"actions": []
},
{
"total": 101.98,
"totalAmountOff": 0,
"actions": []
}
]
},
"aggregates": {
"total": 221.94,
"totalAmountOff": 10
},
"costs": [
{
"name": "Shipping",
"value": 0,
"totalAmountOff": 10,
"actions": [
{
"id": "ba9f8003-2b41-42e2-a889-cf876aa68233",
"amountOff": 10
}
]
}
],
"commitId": null
}
Spend £100 get a specific category of products free
Add line items to the basket with a value of at least £100. All line items contribute to the total. At least one line item should have a custom property of “Category” containing the value “Toys”.
After evaluation one line item that has a “Category” property value of “Toys” will receive a 100% discount action. In this example the “Category” custom property is a multi valued string so the contains operator is used.
Create discount JSON
{
"name": "Spend £100 get 1 Toys Category Product 100% off",
"start": null,
"end": null,
"conditions": [
{
"eligibilityExpression": null,
"lineItemFilter": null,
"lineItemGroupCondition": {
"type": "MinimumSpend",
"values": [
{
"currencyCode": "GBP",
"value": 100
}
]
}
}
],
"actions": [
{
"maxItemsPerApplication": 1,
"lineItemFilter": {
"conjunction": "And",
"type": "Group",
"clauses": [
{
"property": "LineItem.Category",
"operator": "contains",
"value": "Toys",
"type": "Property"
}
]
},
"type": "AmountOffLineItem",
"maxApplications": 1,
"amountOffType": "PercentOff",
"values": [
{
"condition": null,
"value": 100
}
]
}
]
}
Processor API example
Request JSON
{
"basket": {
"items": [
{
"price": 49.99,
"quantity": 2,
"Category": ["Toys"]
},
{
"price": 29.99,
"quantity": 2,
"Category": ["Home"]
}
]
},
"context": {
"currencyCode": "GBP"
},
"settings": {
"dataInstance": "Staging",
"explain": false,
"commit": false
}
}
Response JSON
{
"actions": [
{
"id": "df9703fe-7043-4d27-96b2-9793cfd9ad66",
"discountId": "67fe2c14-7969-4db1-a6ac-2cbd6f1bf206",
"type": "AmountOffLineItem",
"qualifiedCouponCode": null,
"amountOffType": "PercentOff",
"value": 100,
"amountOff": 49.99,
"displayMessages": []
}
],
"basket": {
"total": 109.97,
"totalAmountOff": 49.99,
"items": [
{
"total": 49.99,
"totalAmountOff": 49.99,
"actions": [
{
"id": "df9703fe-7043-4d27-96b2-9793cfd9ad66",
"subItemId": 1,
"amountOff": 49.99
}
]
},
{
"total": 59.98,
"totalAmountOff": 0,
"actions": []
}
]
},
"aggregates": {
"total": 109.97,
"totalAmountOff": 49.99
},
"commitId": null
}
Spend £100 get a specific product free
Add line items to the evaluation basket to a value of at least £100. All line items contribute to the total.
After evaluation one line item that has a “ProductCode” property value of “PROD002” will receive a 100% discount action. In this example the “ProductCode” custom property is a string so the equals operator is used.
Create discount JSON
{
"name": "Spend £100 get PROD002 100% off",
"start": null,
"end": null,
"conditions": [
{
"eligibilityExpression": null,
"lineItemFilter": null,
"lineItemGroupCondition": {
"type": "MinimumSpend",
"values": [
{
"currencyCode": "GBP",
"value": 100
}
]
},
"couponGroupId": null
}
],
"actions": [
{
"maxItemsPerApplication": 1,
"lineItemFilter": {
"conjunction": "And",
"type": "Group",
"clauses": [
{
"property": "LineItem.ProductCode",
"operator": "equals",
"value": "PROD002",
"type": "Property"
}
]
},
"type": "AmountOffLineItem",
"maxApplications": 1,
"amountOffType": "PercentOff",
"values": [
{
"condition": null,
"value": 100
}
]
}
]
}
Processor API example
Request JSON
{
"basket": {
"items": [
{
"price": 49.99,
"quantity": 2,
"ProductCode": "PROD001"
},
{
"price": 29.99,
"quantity": 2,
"ProductCode": "PROD002"
}
]
},
"context": {
"currencyCode": "GBP"
},
"settings": {
"dataInstance": "Staging",
"explain": false,
"commit": false
}
}
Response JSON
{
"actions": [
{
"id": "b705449e-2bcd-4dca-a115-397d1b18d4a7",
"discountId": "52b519b3-e81c-4578-a01e-18b708ff5f1e",
"type": "AmountOffLineItem",
"qualifiedCouponCode": null,
"amountOffType": "PercentOff",
"value": 100,
"amountOff": 29.99,
"displayMessages": []
}
],
"basket": {
"total": 129.97,
"totalAmountOff": 29.99,
"items": [
{
"total": 99.98,
"totalAmountOff": 0,
"actions": []
},
{
"total": 29.99,
"totalAmountOff": 29.99,
"actions": [
{
"id": "b705449e-2bcd-4dca-a115-397d1b18d4a7",
"subItemId": 1,
"amountOff": 29.99
}
]
}
]
},
"aggregates": {
"total": 129.97,
"totalAmountOff": 29.99
},
"commitId": null
}
Return content (e.g. banner)
Add at least 2 line items to the basket that have a “ProductCode” property value of “PROD001”. After evaluation a content item action is returned containing the string "You've bought 2, buy one more!".
Create discount JSON
{
"name": "Qty 2 of ProductCode PROD001 gives \"buy one more content\"",
"start": null,
"end": null,
"conditions": [
{
"eligibilityExpression": null,
"lineItemFilter": {
"conjunction": "And",
"type": "Group",
"clauses": [
{
"property": "LineItem.ProductCode",
"operator": "equals",
"value": "PROD001",
"type": "Property"
}
]
},
"lineItemGroupCondition": {
"type": "MinimumQuantity",
"quantity": 2
}
}
],
"actions": [
{
"type": "Content",
"values": [
{
"condition": null,
"value": [
{
"locale": "en-gb",
"value": "You've bought 2, buy one more!"
}
]
}
]
}
]
}
Processor API example
Request JSON
{
"basket": {
"items": [
{
"price": 49.99,
"quantity": 2,
"ProductCode": "PROD001"
}
]
},
"context": {
"currencyCode": "GBP"
},
"settings": {
"dataInstance": "Staging",
"explain": false,
"commit": false
}
}
Response JSON
{
"actions": [
{
"id": "2e8d6013-a340-4481-9f3f-dde5ed2eb3ec",
"discountId": "8c47ba19-538c-44a7-8ed5-33d0c720c7d8",
"type": "Content",
"qualifiedCouponCode": null,
"value": [
{
"locale": "en-gb",
"value": "You've bought 2, buy one more!"
}
]
}
],
"basket": {
"total": 99.98,
"totalAmountOff": 0,
"items": [
{
"total": 99.98,
"totalAmountOff": 0,
"actions": []
}
]
},
"aggregates": {
"total": 99.98,
"totalAmountOff": 0
},
"commitId": null
}
Spend £75, If VIP customer, get 20% off order
Add any line items to the basket with total value of at least £75. Add to the evaluation request the value “VIP” to the “Customer.Segments” custom property. After evaluation the basket receives a 20% off discount action if the Customer.Segments contains a value of “VIP”.
Create discount JSON
{
"name": "Spend 75 and Customer segment VIP get 20% off",
"start": null,
"end": null,
"conditions": [
{
"eligibilityExpression": {
"conjunction": "And",
"type": "Group",
"clauses": [
{
"property": "Customer.Segments",
"operator": "contains",
"value": "VIP",
"type": "Property"
}
]
},
"lineItemFilter": null,
"lineItemGroupCondition": {
"type": "MinimumSpend",
"values": [
{
"currencyCode": "GBP",
"value": 75
}
]
}
}
],
"actions": [
{
"type": "AmountOffBasket",
"amountOffType": "PercentOff",
"values": [
{
"condition": null,
"value": 20
}
]
}
]
}
Processor API example
Request JSON
{
"basket": {
"items": [
{
"price": 49.99,
"quantity": 2
}
]
},
"context": {
"currencyCode": "GBP"
},
"settings": {
"dataInstance": "Staging",
"explain": false,
"commit": false
},
"customer": {
"segments": ["VIP", "Super", "Premium"]
}
}
Response JSON
{
"actions": [
{
"id": "8f9d16bf-11ac-427d-8eb1-e6e660271c7a",
"discountId": "2b5b424a-8ba5-4bf0-9a2f-b1596d88b815",
"type": "AmountOffBasket",
"qualifiedCouponCode": null,
"amountOffType": "PercentOff",
"value": 20,
"amountOff": 20.0,
"displayMessages": []
}
],
"basket": {
"total": 79.98,
"totalAmountOff": 20.0,
"items": [
{
"total": 79.98,
"totalAmountOff": 20.0,
"actions": [
{
"id": "8f9d16bf-11ac-427d-8eb1-e6e660271c7a",
"subItemId": 1,
"amountOff": 10
},
{
"id": "8f9d16bf-11ac-427d-8eb1-e6e660271c7a",
"subItemId": 2,
"amountOff": 10
}
]
}
]
},
"aggregates": {
"total": 79.98,
"totalAmountOff": 20.0
},
"commitId": null
}
Spend £75, If VIP customer, get 20% off order, Otherwise get 10% off order
Add any line items to the basket with a total value greater than £75. Add to the evaluation request the value “VIP” to the “Customer.Segments” custom property. After evaluation the basket receives a 20% off discount action if Customer.Segments contains a value of “VIP”. If the customer does not match the “VIP” segment then the basket receives 10% off
Create discount JSON
{
"name": "Spend £75 and Customer segment VIP get 20% off else 10% off",
"start": null,
"end": null,
"conditions": [
{
"eligibilityExpression": null,
"lineItemFilter": null,
"lineItemGroupCondition": {
"type": "MinimumSpend",
"values": [
{
"currencyCode": "GBP",
"value": 75
}
]
}
}
],
"actions": [
{
"type": "AmountOffBasket",
"amountOffType": "PercentOff",
"values": [
{
"condition": {
"conjunction": "And",
"type": "Group",
"clauses": [
{
"property": "Customer.Segments",
"operator": "contains",
"value": "VIP",
"type": "Property"
}
]
},
"value": 20
},
{
"condition": null,
"value": 10
}
]
}
]
}
Processor API example - customer is VIP
Request JSON
{
"basket": {
"items": [
{
"price": 49.99,
"quantity": 2
}
]
},
"context": {
"currencyCode": "GBP"
},
"settings": {
"dataInstance": "Staging",
"explain": false,
"commit": false
},
"customer": {
"segments": ["VIP"]
}
}
Response JSON
{
"actions": [
{
"id": "e7831c13-e24a-4f8e-a893-af25b5e2c594",
"discountId": "9dd07374-e308-4c3b-910a-bece1befb9d2",
"type": "AmountOffBasket",
"qualifiedCouponCode": null,
"amountOffType": "PercentOff",
"value": 20,
"amountOff": 20.0,
"displayMessages": []
}
],
"basket": {
"total": 79.98,
"totalAmountOff": 20.0,
"items": [
{
"total": 79.98,
"totalAmountOff": 20.0,
"actions": [
{
"id": "e7831c13-e24a-4f8e-a893-af25b5e2c594",
"subItemId": 1,
"amountOff": 10.0
},
{
"id": "e7831c13-e24a-4f8e-a893-af25b5e2c594",
"subItemId": 2,
"amountOff": 10.0
}
]
}
]
},
"aggregates": {
"total": 79.98,
"totalAmountOff": 20.0
},
"commitId": null
}
Processor API example - customer is NOT VIP
Request JSON
{
"basket": {
"items": [
{
"price": 49.99,
"quantity": 2
}
]
},
"context": {
"currencyCode": "GBP"
},
"settings": {
"dataInstance": "Staging",
"explain": false,
"commit": false
},
"customer": {
"segments": ["Premium"]
}
}
Response JSON
{
"actions": [
{
"id": "4a0ed0e0-4e58-4511-97c4-05d35bdb7c66",
"discountId": "9dd07374-e308-4c3b-910a-bece1befb9d2",
"type": "AmountOffBasket",
"qualifiedCouponCode": null,
"amountOffType": "PercentOff",
"value": 10,
"amountOff": 10,
"displayMessages": []
}
],
"basket": {
"total": 89.98,
"totalAmountOff": 10,
"items": [
{
"total": 89.98,
"totalAmountOff": 10,
"actions": [
{
"id": "4a0ed0e0-4e58-4511-97c4-05d35bdb7c66",
"subItemId": 1,
"amountOff": 5
},
{
"id": "4a0ed0e0-4e58-4511-97c4-05d35bdb7c66",
"subItemId": 2,
"amountOff": 5
}
]
}
]
},
"aggregates": {
"total": 89.98,
"totalAmountOff": 10
},
"commitId": null
}