Languages:
Links - SambaPOS V4
Links
Links - SambaPOS V2
Links - Social Media
—-
Languages:
Links - SambaPOS V4
Links
Links - SambaPOS V2
Links - Social Media
—-
This is an old revision of the document!
Promotion Coupon is an entity that we use to enter free items to tickets. This is a well formatted random number. We can print this number as a barcode or QR Tag. When this number is scanned on a SambaPOS terminal it will add related product into the ticket as a gift product. When redeemed we’ll update coupon status so it can’t be used multiple times.
After finishing this chapter you can create coupons and sell them through a ticket. For example you can sell 100 coffee coupons with a discounted price. That can be a company that wishes to give coffee coupons to their personnel.
On next chapter we’ll see how to record sales on a customer card and give free coupons for 6 coffee purchases.
We’ll create new Entity Type for Coupons. When a new coupon created we’ll store it as a new entity. Primary field of coupon entity is Coupon Number. This number will be a 9 digit number. Eight digits are random generated numbers and ninth digit is check digit to validate number. It starts with CP prefix so we can understand entered random number is a Coupon Number. As a result Coupon Numbers becomes 11 digit numbers. For easy editing we’ll split this number with minus characters. On Primary Field Format C is a place holder for a single character. Define length and editing format as CCCCC-CCC-CCC. Read Primary Field Editing Formats document for more info.
We’ll create some custom fields for coupons.
We have three custom fields.
We’ll need actions to update Coupon custom fields. For example we have to change Redeemed value to “Yes” when coupon is used in a ticket. Let’s create a new action to update Coupon Menu Item Name.
Action Name will be Update Coupon Menu Item Name
and Action Type will be Update Entity Data
. We’ll set Entity Type Name as Coupons
so this action updates Coupons. Field Name will be Menu Item Name
since we store menu item names under this field. We’ll send Coupon Number and Menu Item Name values from calling rule for this reason we’ll configure these parameters as variables.
We need another action to update Coupon Redeem Status. Let's clone a new action from previous one.
Change action name to Update Coupon Status
and Field Name as Redeemed
. We’ll use this action when we create new coupons and when we need to disable them.
Until this step we created Coupon Entity Type, needed custom fields and two actions to update these custom fields. Now we’ll need a product called “Coffee Coupon” to sell Coffee Coupons.
You should have something like this.
You can add more coupon products under this category. Coffee price is $1.45 on my sample data so I’ve priced Coffee Coupon as $1.45 to match it to Coffee price.
So when we sell Coffee Coupon
we’ll create a new Coupon entity. For this reason we need to handle Order Added
event to understand if Coffee Coupon is added to ticket. However we need to solve an issue here. We can’t create coupon entity as soon as Coffee Coupon
product added to ticket because user can cancel it after printing Coupon to generate free coupons. We need to create coupons when ticket gets paid. We can use Order Status
feature to determine if Coffee Coupon Product is paid or not. When we first add Coupon Product we’ll change order state to Coupon Ordered
and when Ticket Paid we’ll change it to Coupon Paid
. SambaPOS generates additional events when an order status is changed so we can understand Coupon is paid. Let’s create needed actions to update order states.
When we add a Coffee Coupon
product to a ticket default order state will be Coupon Ordered
. When ticket paid it becomes Coupon Paid
. We’ll handle the moment order status changes to Coupon Paid
from Coupon Ordered
to create coupons. Group order and State order values are useful to sort state values while displaying multiple orders.
You'll remember Coupon entity has a field called Menu Item Name
. We use this field to map coupons to Menu Items. So while creating a coupon we need to update Menu Item Name
value. Instead of directly mapping Coffee Coupons to Coupon entities we’ll create additional Order State to store Menu Item Name. It will give more flexibility when you need to create coupons for different products.
Now we have another order state called Coupon Product
. We don’t need to know previous state value so we’ll leave Current State parameter empty. Group and State Order values are 5 since we want to display this value at the end.
As a result Coupon Order Lines stores two additional data.
Coupon Ordered
when coupon product first added and Coupon Paid
when ticket paid.
Another action we need is Create Coupon
action. When we call it will generate a new Coupon with a Random Number.
Entity Type Name is Coupons
since we need to create a coupon entity. Entity name should be CP{RANDOMC:8}
. {RANDOMC:8} tag is a Number Generator Tag that generates a 8 digit random number with check digit. So it becomes 9 digits. We also want to prefix Coupon Numbers with CP letters to be able to understand this random number is a coupon number. Finally Custom Data field contains Redeemed=No
value to define default Redeemed field value.
We’re ready to create rules that creates Coupons when Coffee Coupon Product
sold.