Skip to main content

Collect 1 point per dollar spent

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

Let's create a promotion rule that awards customers with one loyalty point per dollar they spend on accessories.

Creating the loyalty wallet promotion

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

Cart item filters

Let's start by creating the cart item filter to find and count the accessories in the session:

  1. Click Add Filter.
  2. Click Add Filter Step and select Filter items by condition.
  3. Set the filter to Item category (Item) is equal to Accessories.
  4. In Save As, type Accessories and click Save Filter. This creates the Accessories filter. The Accessories item count (Accessories) filter is automatically created, which returns the number of items in the filter.

Condition

Talon.One offers many conditions. Let's add the condition to check if there are accessories in the session:

  1. Click Add condition and select Check attribute value.
  2. Compose the following expression: Accessories item count (Accessories)is greater than 0.

Effect

Let's set the Add loyalty points per item effect:

  1. Set Cart item filter: Accessories.
  2. Set Loyalty program to Sample Wallet. This wallet is created by default in your demo deployment.
  3. Set Recipient to Current Customer.
  4. Set Reason to 1 point per $ spent on accessories to identify why they were awarded a point.
  5. Set Amount of point to: Quantity of item (Item)*Price of item (Item).
  6. Select the whole expression and click Round up to get: Round_up(Quantity of item (Item)*Price of item (Item)).

Running the campaign

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

Let's create a session with 2 items:

  • Line 12: ProductC is an accessory.
  • Line 22: ProductA isn't an accessory and will be excluded from point calculation.
Sending a session update
CURL -X PUT https://mycompany.europe-west1.talon.one/v2/customer_sessions/my_session_id -d
'{
"customerSession": {
"profileId": "EWRU87GENV",
"state": "closed",
"cartItems": [
{
"name": "ProductC",
"sku": "sku-00004",
"quantity": 1,
"price": 200,
"Category": "Accessories",
"weight": 0,
"position": 0,
"attributes": {}
},
{
"name": "ProductA",
"sku": "sku-00001",
"quantity": 1,
"price": 100,
"Category": "",
"weight": 0,
"position": 0,
"attributes": {}
}
],
"couponCodes": [
""
],
"referralCode": "",
"attributes": {},
"additionalCosts": {}
},
"responseContent": []
}'
Key Takeaways
  • You can reward customers with loyalty points with the Add loyalty points effect.
  • Loyalty points are kept in a given loyalty program.