Skip to main content

Awarding 1000 points for three purchases over $300 each

Prerequisites
Before you start, ensure you:
  1. Create your Integration API key.
  2. If you haven't done so already, fork our Sample Campaigns collection in Postman: Run in Postman.
  3. In the Campaign Manager, open the ADVANCED-GAMIFICATION: Spend more than $300 three times and get 1000 points demo campaign and click Activate Campaign.
  4. Open the Rule Builder to get some context.

Let's create a gamification promotion rule that gives 1000 loyalty points to customers who spend over $300 three times. Their three qualifying spends need not be consecutive.

important

This tutorial shows how we can use native Talon.One features as workaround to create complex rules. In this case, we'll use a fake loyalty program to count sessions.

Creating the promotion

In the current scenario, let's use two rules:

  1. Count Transactions over $300
  2. 3rd transaction over $300

Creating the subledger accessor

Let's create a subledger in our loyalty program to keep track of the number of sessions of a given value each customer makes.

  1. Click Subledger accessor.
  2. Set Loyalty program to Transaction counter and in Subledger type TransactionOver300. This creates a new subledger inside the Ledgers loyalty program.
  3. Save it as TransactionOver300.

Rule 1: Count transactions over $300

Let's add a free item to sessions when they reach $300:

  • Conditions:

    1. Check for default event: Customer Closing session.
    2. Check attribute value: Session Total (Current Session)is greater than 300.
  • Effect: Add loyalty points and select:

    • Loyalty program: Ledgers
    • Subledger name: TransactionOver300
    • Recipient: Current customer (friend)
    • Reason: 1 transaction over $300
    • Amount of points: 1

This use of a subledger allows us to keep track of the number of transactions of 300. It's not related to points in this case. It functions as a counter.

Rule 2: 3rd transaction over $300

This rule detects the third transaction and grants 1000 points.

  • Conditions:

    1. Check for default event: Customer Closing session.
    2. Check attribute value: Session Total (Current Session)is greater than 300.
    3. Check attribute value: Current Balance (TransactionOver300)is equal to 3.
  • Effect: Add loyalty points and select:

    • Loyalty program to Sample Wallet. Note that we do not use the subledger for this.
    • Recipient to Current Customer.
    • Reason to 1000 bonus points.
    • Amount of point to 1000.

When a customer places an order for the third time, they will get 1000 points.

Running the campaign

To run and test the campaign, we need three requests to trigger our two rules. We send the requests to the Integration API's Update customer session endpoint.

A customer makes two purchases of $300 each

Let's send two requests for the same customer profile but with different sessions. That cart has a total value of $310 every time. The sessions must be closed.

Sending a session update
CURL -X PUT https://mycompany.europe-west1.talon.one/v2/customer_sessions/my_session_id -d
'{
"customerSession": {
"profileId": "A_given_customer",
"state": "closed",
"cartItems": [
{
"name": "ProductL",
"sku": "sku-00003",
"quantity": 1,
"price": 310,
"Category": "",
"weight": 0,
"position": 0,
"attributes": {}
}
],
"couponCodes": [""],
"referralCode": "",
"attributes": {

},
"additionalCosts": {}
},
"responseContent": []
}'

Sending the last of the three sessions

The last session we close for the same customers triggers the point addition.

Sending a session update
CURL -X PUT https://mycompany.europe-west1.talon.one/v2/customer_sessions/my_session_id -d
'{
"customerSession": {
"profileId": "A_given_customer",
"state": "closed",
"cartItems": [
{
"name": "ProductL",
"sku": "sku-00003",
"quantity": 1,
"price": 310,
"Category": "",
"weight": 0,
"position": 0,
"attributes": {}
}
],
"couponCodes": [""],
"referralCode": "",
"attributes": {

},
"additionalCosts": {}
},
"responseContent": []
}'
Key Takeaways
  • Talon.One's core features are flexible and can be used as workarounds to implement advanced logic.