20% off when session value >200
- Create your Integration API key.
- If you haven't done so already, fork our Sample Campaigns collection in Postman:
- In the Campaign Manager, open the EASY-DISCOUNT: 20% off when session value greater than $200 demo campaign and click Activate Campaign.
- Open the Rule Builder to get some context.
Let's create a promotion rule that provides a 20% discount to every customer whose session value reaches $200.
This tutorial builds upon the Always triggering a discount tutorial, where we learned how to set up a rule that always triggers. In this tutorial let's create our first condition to ensure the discount is only applied to customer sessions whose value exceeds 200USD.
The currency for this example is USD. The currency can be edited in the details of your Application.
Creating the conditional discount promotion
In the current scenario, let's use one rule and name it
20% off with basket value >200.
Talon.One offers many conditions. In our case we need the following condition:
Click Add condition and select Validate attribute value.
This condition allows you to check the value of an attribute against another value, or another attribute.
Click Customer Name (customer profile) to replace it.
Search for Session Total (Current Session) and select it.
Replace is equal to with is greater than.
In the field right of is equal to, type
200and press enter.
This condition means that we are now checking the value of the Session Total (Current Session) attribute and if this value is greater than $200, this condition is true and Talon.One triggers the discount effect.
Let's set the Discount session total effect:
- Set the Name to something descriptive, such as
- Set the Discount value to [Session.Total]
- Click Add an attribute ( ).
- Search for the Session Total (Current Session) attribute and select it.
- Back in the Discount value field, type
* 20%to complete the discount value.
As in the previous tutorial, we calculate the discount value using the same Session total attribute.
Discount session total: Name is
20% off and Discount value is [Session.Total]
Running the campaign
To run the campaign, use the following payload sent to the Integration API's Update customer session endpoint:
- 🚀 Request
- ✅ Response
To trigger the rule, the session value must be greater than 200, which is the sum of all cart items. In this case, let's share one item for 233USD.
CURL -X PUT https://mycompany.europe-west1.talon.one/v2/customer_sessions/my_session_id -d
We receive this response showing our only effect in the
a 20% discount representing 46.6USD off the original session value.
"ruleName": "20% off with basket value >200",
"name": "20% off",
- Attributes can be used in effects, but also in conditions.
- For more control, we can check for specific events to trigger effects at specific moments in the life cycle of the customer session.
- You can use several conditions in one rule.
- By default, when using several conditions, all of them must be true for the effects to be applied.