Tracking Promotions by Points

Hello. In this tutorial I’ll show you how to create points based promotions.

  • Upgrade to at least 4.1.27 version before starting this tutorial.
  • If you have Database Tools Module you can simply use this import file for easily importing this configuration to your database. (1.6 KB) Please test it first on a safe environment before merging it to your production database.
  • For the simplicity of this tutorial I’ve skipped Rule Mapping steps. After creating each rule, create a default mapping by adding a mapping line and leaving it unchanged.

##Earning Points

First we’ll start by creating a custom product tag. This tag will be named as Points

After saving it I can edit products and set promotion points. We’ll give free Coffee for 6 points.

… and free Juice for 8 points.

I’ll create a custom field for Customers to store their points. To be able to do this I’ll add a custom field.

I need an action to increase customer points. I’ll use Update Entity Data action for this.

… and another one to decrease points.

I need to change promotion product’s order state to track from which products customer can earn points. I’ll use Update Order State action to mark an order so when ticket gets paid we’ll increase customers points by using this information.

We’ll use Order Added to Ticket rule to check product’s promotion points and if it is greater than 0 and if a customer is selected we’ll change order’s promotion state. We are using two step here because we won’t increase Customer Points immediately as order added to ticket. We’ll do it when ticket gets paid.

When ticket gets paid I’ll change promotion orders state from Points to Earned. I’m using Ticket Payment Check rule for this. So every orders that have Points state changes to Earned and we’ll update customer points.

When an order’s state becomes Earned, Order State Changed event fires. I can handle it with a rule to increase customer points.

For every Coffee or Juice customer buys she’ll earn 1 point.

Let’s sell 2 Coffee and 1 Juice to a customer and check how Points data changes.

Coffee and Juice state changes. Herbal Tea does not change since it is not included.

When I settle this ticket customer points increases to 3 as shown here. Every promotion products we sell increases points by 1.

##Using Points

On the next step I’ll create actions for giving free items.

I’ll start by creating an Automation Command for Use Points button.

I’ll map this command to Order Lines that have Points state.

Notice how I’m mapping this button to Order Line and make it visible for promotion orders by changing Visible State value to Points.

I’ll create two rules to handle this button. If customer points is less then promotion points we’ll display a warning. If customer have enough points we’ll gift that item.

Before creating rules I’ll create an action to display messages.

First rule will check if customer have enough points.

[={QUANTITY}*{ITEM TAG:Points}] is a custom expression to multiply product promotion points with order quantity. If Customer wants to use her points for 2 free coffee she need to have 12 points since a single Coffee needs 6 points.

We’ll create another rule to apply points. This rule is a little crowded so I’ll add separate screenshots to show all action parameters.

First action will decrease Customer Points I’m using same custom expression to calculate exact points if order quantity is more than 1.

Second action will change order to a free order. Nothing special here. We only need to change Decrease value to True and Calculate Price to False.

Third action will change order’s Gift state to Promotion. Since we immediately decrease customer points we need this operation to disable Cancel Gift command.

Final action will clear order’s promotion state. We’ll just leave all values empty.

Let’s see how it works.

If you remember Jane White already have 3 points. We’ll add one coffee and click Use Points button.

We can’t give free coffee since we need at least 6 points. If I sell more coffee to increase points and try to use this function it should change order to a gift.


Hi Emre

Very good detail Tutorial.

This was happened when i test this.

if i add product first to the order and choose customer later than it doesn’t add points to customer’s account. can we do anything for this? (choose customer at any time during the order)

how i can define different point for different product? right now they all get 1 point regardless of product price. i want to make 1 point for every $ customer paid.

@allmixedup I’ve enabled promotion tracking with customer selection to avoid useless tracking for tickets that you’ll never assign a customer. You can change this by removing second constraint check on Order Added to Ticket rule.

Hi emre

How to set up different point for different product?

Tutorial already shows how to set up 6 points for Coffee and 8 points for Juice. You can change Points tag for other products.

Did you meant something different?

HI Emre

Yes I mean add point ( if they buy coffee they get 1 point if they buy salad they get 4 point)

or can we set every $ they spent = 1 point added to the account? ( right now you set as Quantity if I understand right)

OK. This tutorial assumes customer earns 1 point for every promotion item they buy. You can create an additional product tag (for example Reward) to configure how many points that product will add and change Update Customer Points... rule to [=TN('{ITEM TAG:Reward}') * {QUANTITY}].

Hi Emre

[=TN(’{ITEM TAG:Reward}’) * {QUANTITY}]

That works but I have to put reward point in every product which is lot of manual work

I tried this [=FF(TN(’{TICKET TOTAL}-{TAX TOTAL}’)-0.50,‘0’)] but no luck :frowning:

putting the above format I thought I can get subtotal round down to number (subtotal $5.25 --> 5 point) but no luck

if any one can figure out, please replay this way we can configure reward point to every $ customer spent = 1 point and even slow business day business owner can offer double the point by simple adding *{2}

@allmixedup this configuration is based on point based promotion. For configuring payment based promotion please review sample file included in SambaPOS Loyalty Card Features topic.

Dear @Emre, I am starting to use this promotional points module, but i have one silly question…
After I redeem the points it takes a lot to see the new amount of point the customer has… as a matter of fact it does not update customer points until I create a new ticket, is that correct?



It should update the Points as soon as the Ticket is Settled (Paid). Displaying the Points that the Customer has Earned seems a little tedious though.

It could be stored in a Ticket Tag along with the Ticket, but I’d rather be able to see the Points (and Account Balance) on something like an Entity Grid.

Hi there @QMcKay, I have to open a new ticket to see the redeemed points substracted…



We intentionally update points after payment to prevent fraud. If we update it immediately operator can sell free items by adding fake orders.

You can change it as you wish :slight_smile:

Great tutorial and great product @emre. But how can we prevent points from being deducted if customer does not have enough points? Example: Customer has 100 points and tries to use them for a product that requires 150 points, what happens is the warning message is shown but the 150 points are deducted anyway.

@emre As I tried to install through tools module but there is a error , than I tried to do manually the first step product tag , There is only one product tag tab its been used by Kitchen Group , Is there any way to implement points promotion ? please

We do not know what error you mention because you have not shared this with us so it will be hard to help you with it. Your question is extremely vague with almost no supporting information. We can not understand what you want without clear explanations.

Please share with us what you are trying to do and give us more details about your system and how you have set it up so we can maybe provide suggestions.

@kendash Hello there, I want to implement points promotion I downloaded .zip file but when importing there is a error message , so I thought do it manually as guided in this page but the first step of the setup product tag Captions been used by Kitchen group as I want the products grouped so I did that setup , I cannot type points in the product tag captions , the question was that thanks for reply

What was the error? If you can share this we might be able to fix the import.

I am sorry but you basically just asked the same thing twice and still have not provided much information to work with. Not everyone’s system is the same and it could be something you did wrong but we have no way to know that unless you share more about your setup and or what you did to try and set this up.

I’ve reproduced the error. Sadly the code I’ve implemented to import duplicated actions caused an issue for that file. I’ll try to refresh it with a working one.

1 Like

@emre Thank You So much u got it