Skip to main content

Spend 1 point as 1 dollar

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 MEDIUM-LOYALTY: Spend 1 point as 1$ demo campaign and click Activate Campaign.
  4. Open the Rule Builder to get some context.

Let's create a promotion rule that allows customers to pay using the points they collected. One point should equal one dollar.

Creating the coupon promotion

In the current scenario, let's use one rule and name it 1 point = $1.

Condition

We want the rule to redeem points when they are used, meaning when the customer has paid for the order. This is represented by a closed session in Talon.One.

  1. Click Add condition and select Check for event type and validate custom event values.
  2. Select Customer Session Closing.

Effects

The logic of the rule relies on 2 effects:

  1. Setting the value of a point via a discount effect.
  2. Redeeming points when they are used.

We have to know how many points each customer wants to use. For this, we assume that your shop system has a way for the customers to input how many points they want to use as they are about to place their order.

This number of points must be communicated to Talon.One, and we do this with a custom attribute called DEMO Points to spend (Current Session). This custom attribute was created for the purpose of the demo. Attributes are set during the request to the Update customer session endpoint.

Let's set the Set discount effect, which sets the value of a point:

  1. Set Discount name to Spending loyalty points.
  2. Set Discount value to [Session.Attributes.PointsToSpend]. In other words, the discount itself is the number of points used. So for example: 12 points is a discount of $12.

The next effect redeems points as they are used by the customer:

  1. Set Loyalty program to Sample Wallet, which is provided in the Demo deployment.
  2. Set Recipient to Current Customer.
  3. Set Reason to Spending loyalty points to identify why points were deducted.
  4. Set Amount of point to [Session.Attributes.PointsToSpend].

Running the campaign

To run the campaign, use the following payload sent to the Integration API's Update customer session endpoint:

To trigger the rule, we must:

  • Line 5: Send a session with a closed state
  • Line 23: Set a value for the [Session.Attributes.PointsToSpend] attribute.
Sending a session update
CURL -X PUT https://mycompany.europe-west1.talon.one/v2/customer_sessions/my_session_id -d
'{
"customerSession": {
"profileId": "{{Integration_id}}",
"state": "closed",
"cartItems": [
{
"name": "ProductC",
"sku": "sku-00004",
"quantity": 1,
"price": 200,
"Category": "",
"weight": 0,
"position": 0,
"attributes": {}
}
],
"couponCodes": [
""
],
"referralCode": "",
"attributes": {
"PointsToSpend": 50
},
"additionalCosts": {}
},
"responseContent": []
}'
Key Takeaways
  • You can redeem or deduct loyalty points with the Redeem loyalty points effect.
  • To set the value of a loyalty point, use a discount effect and use an attribute related to points in the Discount value field.
  • Attributes, custom or not, are set in the Update customer session requests.