# Gift Certificate Sales & Redemption

**URL:** <https://forum.sambapos.com/t/gift-certificate-sales-redemption/1539>\
**Category:** V4 Tutorial\
**Created:** [June 12, 2014, 9:12pm UTC](https://forum.sambapos.com/t/gift-certificate-sales-redemption/1539 "2014-06-12T21:12:48Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![QMcKay](https://forum.sambapos.com/user_avatar/forum.sambapos.com/qmckay/32/27925_2.png) [@QMcKay](https://forum.sambapos.com/u/QMcKay)\
**Post date:** [June 12, 2014, 9:12pm UTC](https://forum.sambapos.com/t/gift-certificate-sales-redemption/1539/1 "2014-06-12T21:12:49Z")

</div>

**Gift Certificate Sales & Redemption**

This is a working implementation for Selling & Redeeming variable-value `Gift Certificates` (GCs) that are tracked under their own individual GC Account and 2 “GC Balance” Accounts called “GC Purchases” and “GC Redemptions”.

**GC Sale:**

- Customer comes in to purchase a Gift Certificate (GC).
- Enter the value of the GC that the customer wants to purchase into the NUMBERPAD ($10, $20, etc).
- Select GC Product (open price).
- Settle the ticket - customer pays for the GC using Cash, Credit Card, or another Payment Type.
- Gift Certificate Entity & Account is created using a name composed of current Date, Time, and Value of the GC being purchased (i.e. `GC2014061315325614520` would be the `Entity Name` & `Account Name` of a GC purchased on `2014-06-13` at `15:32:56.145` for a value of $`20`).
- Gift Certificate Prints containing Value ($`20`)and Control Code (`GC2014061315325614520`).

**GC Redemption:**

- Customer comes in with a Gift Certificate (GC) that they want to Redeem (use as Payment). Assuming the GC has a value of $20…
- They order some food and drink products, and it comes to a total of $33.
- They want to use the GC as partial payment ($20), and pay the remainder in Cash ($13).
- We scan or enter the GC Control Code (i.e. `GC2014061315325614520`), or search for it in a list of unredeemed Gift Certificates allowing us to verify the GC has not yet been (fully) used, and it enables the `Gift Certificate` Payment Type to settle the Ticket (in whole or in part).
- For the remainder of the Ticket, the balance left to pay is $13, and we settle that with Cash.

This setup and implementation is based on the discussion and initial tutorial provided by @JohnS, found in this thread: [GC Sales & Redemption](http://forum.sambapos.com/t/gc-sales-redemption/1413).

With the gracious & frequent help & guidance of @emre and @JohnS, the Tutorial which follows introduces many changes to the initial setup previously provided. The changes are mostly to track `Gift Certificates` under their own Accounts, and 2 overall GC Balance accounts, steering clear of the `Sales` account, facilitating better control & reporting of the “ **GC Product** ” and its balances.

Let’s get to it!

* * *

**Components required:**

**GC Product:** `Gift Certificate`

**Account Types:** `GC Accounts`, `GC Balances`  
**Accounts:** `GC Purchases`, `GC Redemptions`, `GC Payment Account`, `ZZGC2000` “dummy” account  
**Account Screens:** `Gift Certificates`, `General`

**Transaction Types:** `GC Credit Transaction`, `GC Debit Transaction`, `GC Purchase Transaction`, `GC Redemption Transaction`

**Document Types:** `GC Purchase Doc`, `GC Redemption Doc`

**Payment Types:** `Gift Certificate`

**Entity States:** (GCStatus) `Purchased`, (GCStatus) `Redeemed`

**Entity Types:** `Gift Certificate`  
**Entities:** `ZZGC2000` “dummy” entity  
**Entity Screens:** `Gift Certificates` (Search)

**Ticket Types \> Ticket \> Entity Type List:** `Gift Certificates`

**Printer Template:** `GC Template`  
**Print Job:** `Print GC`

**Automation:** several `Actions` & `Rules`

* * *

**GC Product:**

![](https://forum.sambapos.com/uploads/default/original/3X/d/2/d2e0d19ced76e63d52e449c3c089e56f74d8bd67.png)

The GC Product “ **Gift Certificate** ” has a Price of `0.00` … it’s an “open price” product.

* * *

**GC Account Types - GC Accounts & GC Balances:**

![](https://forum.sambapos.com/uploads/default/original/3X/0/7/07542c1e5e29ed6f89aa19450be43741c9f3b6bb.png)

`GC Accounts`: holds the balance of each individual GC.  
`GC Balances`: holds the **total** balances of **all** `Purchased` & `Redeemed` GCs.

* * *

**GC Accounts - Purchases, Redemptions, Funds, & Dummy:**

 ![](https://forum.sambapos.com/uploads/default/original/3X/a/6/a6235e8b3f75f0cdc108254b31732d436cc3fdf3.png)

`GC Purchases`: holds the **total** balance of **all** `Purchased` GCs.  
`GC Redemptions`: holds the **total** balance of **all** `Redeemed` GCs.  
`GC Funds`: Credit/Debit account for GC Purchases/Redemptions.  
`ZZGC2000`: a “dummy” account with zero (`0`) balance, used in place of completely depleted (fully redeemed) GCs.

* * *

**Account Screen - Gift Certificates:**

![](https://forum.sambapos.com/uploads/default/original/3X/4/9/49fa2bbb1469653cee8984da8e6e65ff5c781404.png)

The `Gift Certificate Account Screen` allows us to view the values of all Purchased & Redeemed GCs, and lists any GCs which still have a balance that can be used as Payment, filtered as “`All`” so we see the complete history.

* * *

**Account Screen - General:** (optional)

![](https://forum.sambapos.com/uploads/default/original/3X/b/c/bc725e458ac6754c3d643217b0ca368df5d8e38d.png)

The General Account Screen can also display GC Purchases, Redemptions, and Balances, filtered by “`WorkPeriod`”, so we see only GC transactions appearing today.

* * *

**Account Transaction Types: GC Credit & GC Debit:**

 ![](https://forum.sambapos.com/uploads/default/original/3X/7/8/785031456a995267455ed6640a02fdd87490bd49.png)

`GC Credit Transaction`: during GC **Purchase** , transfers funds from `GC Funds` to `GC Account` that is being purchased.  
`GC Debit Transaction`: during GC **Redemption** , transfers funds from `GC Funds` to `GC Redemptions` account.

* * *

**Account Transaction Types: GC Purchase & GC Redemption:**

 ![](https://forum.sambapos.com/uploads/default/original/3X/b/1/b1ada10cc35f067cd93328dcf8f1b258b60ad78b.png) 

`GC Purchase Transaction`: during GC **Purchase** , transfers funds from `GC Purchases` account to `Receivables` account.  
`GC Redemption Transaction`: during GC **Redemption** , transfers funds from `Receivables` account to `GC Account` that is being redeemed.

* * *

**Document Type - GC Purchase:**

![](https://forum.sambapos.com/uploads/default/original/3X/6/d/6d1eaa19d195ddc71b37a7c74bc9a3ddf7c7bfd0.png)

`GC Purchase Doc`: handles `GC Credit Transaction` when GC is **Purchased**.

**Document Type - GC Redemption:**

![](https://forum.sambapos.com/uploads/default/original/3X/1/3/13243ae050085027ee675a50b96b3c999c90db5f.png)

`GC Redemption Doc`: handles `GC Debit Transaction` when GC is **Redeemed**.

* * *

**Payment Type - Gift Certificate:**

![](https://forum.sambapos.com/uploads/default/original/3X/f/4/f4ac137bec257d10f699259d665311b6d5ff6bbf.png)

`Gift Certificate`: provides for a button on the `Payment Screen` (similar to `Cash` or `Credit Card`), enabling the Redemption of a GC when Settling a Ticket, which invokes the `GC Redemption Transaction`.

* * *

**Entity States for GCStatus - Purchased & Redeemed:**

 ![](https://forum.sambapos.com/uploads/default/original/3X/c/d/cd07678f7794e18258477f22b6ae9551e54beced.png) 

The `GCStatus` Entity States are used to easily track the Status of the GC, as either being **Purchased** or **Redeemed** (in full):

`Purchased`: indicates the GC has a `Balance > 0`.  
`Redeemed`: indicates the GC has a `Balance = 0`.

* * *

**Entity Type - Gift Certificates:**

![](https://forum.sambapos.com/uploads/default/original/3X/5/6/561a9598c906cfa978adadd9edade17b7b7ffc43.png)

`Gift Certificates` Entity Type defines the `Gift Certificate` Entity, which use an Account Type of `GC Accounts`.  
`GCBalance`: this Custom data field will be updated to display the balance of the individual `GC Account`.

* * *

\*\* Gift Certificate Entity - GC Dummy “ZZGC2000”:\*\*

![](https://forum.sambapos.com/uploads/default/original/3X/8/f/8f3fac9736e462ff9a3bda924b3f2b285204b790.png)

`ZZGC2000`: a “dummy” GC Entity with `GCBalance=0` linked to “dummy” Account `ZZGC2000` to be used in place of GCs that have been fully redeemed.

* * *

**Entity Screen - GC Search:**

![](https://forum.sambapos.com/uploads/default/original/3X/3/9/39701c48c2a5d3f485935673edb856460351f026.png)

`Gift Certificates` Entity Screen, set to `Search` mode, and filtered to display only GC Entities with a (`GCStatus`) State of `Purchased` will list all GC Entities which are not fully Redeemed.

* * *

**Ticket Type - Entity Type List - GC Entity Search:**

![](https://forum.sambapos.com/uploads/default/original/3X/9/f/9f3a68e27ba75db97a3a86d4abb8b7c2597badff.png)

Adding `Gift Certificates` to the `Entity Type List` of our `Ticket Types` provides a button on the left side of the screen to search for and select a GC, in the same way we select Tables and Customers on a Ticket.

* * *

**Ticket Tags - Gift Certificate Name - GCN:** (optional)

![](https://forum.sambapos.com/uploads/default/original/3X/5/7/57d5f9f2e476f251553f8efa516b2fa0576b7e92.png)

We will use the Ticket Tag `GCN` to store the name of the Gift Certificate used during **Redemption**. This is useful to format output on a Ticket (Receipt) to show information about a GC when it is used as Tender.

* * *

**Ticket Tags - Gift Certificate Balance - GCB:** (optional)

![](https://forum.sambapos.com/uploads/default/original/3X/0/8/082508074aaa8a520635402764335cc82ade3620.png)

We will use the Ticket Tag `GCB` to store the remaining Balance of the Gift Certificate used during **Redemption**. This is useful to format output on a Ticket (Receipt) to show information about a GC when it is used as Tender.

* * *

**Printer Template - GC Template:**

![](https://forum.sambapos.com/uploads/default/original/3X/2/1/2151059c4bb8fb30b00a9eaba43adbe112c3f8c0.png)

`GC Template`: used to format the output of the printed GC - modify it to suit your needs…

```
[LAYOUT]
-- General layout
<EB>
<T>The Best Restaurant
<DB>
<J00>{DOCUMENT DATE} {DOCUMENT TIME}
<L>
<EB>
<C01>GIFT CERTIFICATE
<DB>
<L>
{TRANSACTIONS}
<C>NO CASH VALUE
<F>*
[TRANSACTIONS]
<C11>{AMOUNT}
<L>
<F>-
<EC>
-- <QR>{SOURCE ACCOUNT}
-- <BAR>{SOURCE ACCOUNT}
<EL>
<J00>{SOURCE ACCOUNT} | {AMOUNT}

```

* * *

**Print Job - Print GC:**

![](https://forum.sambapos.com/uploads/default/original/3X/9/5/955955ce23cce6e121dc4bc328faadd65b586195.png)

`Print GC`: the Print Job that prints the GC to the `Ticket Printer` using the `GC Template`.

* * *

**Printer Template - Ticket Template addition:** (optional)

```
[<F>=
<J00>{TICKET TAG:GCN}|Balance: [=F(TN('{TICKET TAG:GCB}'))]]

```

If you set up the **Ticket Tags** for `GCN` and `GCB`, including the `Actions` & `Rules`, the above `Printer Template code` can be added somewhere to your regular Ticket Template (Customer Receipt), to show Balance information of a Redeemed Gift Certificate.

* * *

**Automation - Actions & Rules:**

Now that all the Components are in place, we need to define how they interact with each other using `Actions` & `Rules`.

First, we define all the **Actions** …

* * *

**Action - AC Display Ticket:**

![](https://forum.sambapos.com/uploads/default/original/3X/0/2/02af5ceb112c328af8dd28a1391bd4e3d8cf4179.png)

A “generic” Action to Display a Ticket, given a `Ticket Id`.

**Name:** `AC Display Ticket`  
**Type:** `Display Ticket`  
**Ticket Id:** `[:TicketId]`

* * *

**Action - GC Credit & GC Debit:**

![](https://forum.sambapos.com/uploads/default/original/3X/0/e/0e6b7be088d47576ac0e17efe78bd4cbbe002cfe.png)

Actions to Credit & Debit accounts when a GC is **Purchased** and **Redeemed**.

**Name:** `AC GC Purchase`  
**Type:** `Create Account Transaction Document`  
**Document Name:** `GC Purchase Doc`  
**Account Name:** `[:Account Name]`  
**Description:** `GC Credit Account [[:CertNum]]`  
**Amount:** `[:Amount]`

**Name:** `AC GC Redeem`  
**Type:** `Create Account Transaction Document`  
**Document Name:** `GC Redemption Doc`  
**Account Name:** `[:Account Name]`  
**Description:** `GC Debit Account [[:CertNum]]`  
**Amount:** `[:Amount]`

* * *

**Action - Update Order Transaction Type for GC Purchase:**

![](https://forum.sambapos.com/uploads/default/original/3X/6/6/662ef2502a2179b7333cf1c4369da9cec5a1943d.png)

Action to update the `Transaction Type` when a GC is **Purchased**. This allows the Sale of a GC to be tracked under a separate `GC Purchase` Account rather than the default `Sales` Account.

**Name:** `AC GC Update Transaction Type`  
**Type:** `Update Order`  
**Account Transaction Type:** `GC Purchase Transaction`

* * *

**Action - Update Order State for GC Product:**

![](https://forum.sambapos.com/uploads/default/original/3X/8/4/840e30dbf216d91598ddc7b9c2c31b5aef75da1b.png)

Action to update the Order State of a GC when it is being **Purchased**.

**Name:** `AC GC Update Order State`  
**Type:** `Update Order State`  
**State Name:** `Certificate`  
**Group Order:** `3`  
**Current State:** `[:Current State]`  
**State:** `[:State]`  
**State Order:** `3`

* * *

**Action - Create GC Entity:**

![](https://forum.sambapos.com/uploads/default/original/3X/6/c/6cc35cd026474516c90591ae7d33d8aeaf495ba6.png)

Action to Create the GC Entity when it is **Purchased**.

**Name:** `AC GC Create`  
**Type:** `Create Entity`  
**Entity Type Name:** `Gift Certificates`  
**Entity Name:** `GC[:Certificate Number]`  
**Create Account:** `True`

* * *

**Action - Print GC:**

![](https://forum.sambapos.com/uploads/default/original/3X/b/5/b5a6d378db837cc9d95893e8e99a2dea11ed98ed.png)

Action to Print the GC when it is **Purchased**.

**Name:** `AC GC Print`  
**Type:** `Print Account Transaction Document`  
**Document Id:** `[:DocumentId]`  
**Printer Name:** `Ticket Printer`  
**Printer Template Name:** `GC Template`

* * *

**Action - Update Entity Data “GCBalance”:**

![](https://forum.sambapos.com/uploads/default/original/3X/9/9/995bc30b0a5042feee4c11e412e747185d5b9ffe.png)

Action to update the GC Entity Custom Data Field named `GCBalance`, when a GC is **Purchased** or **Redeemed**.

**Name:** `AC GC Balance Update`  
**Type:** `Update Entity Data`  
**Entity Type Name:** `Gift Certificates`  
**Entity Name:** `[:CertNum]`  
**Field Name:** `GCBalance`  
**Field Value:** `[:Bal]`

* * *

**Action - Update Entity State “GCStatus”:**

![](https://forum.sambapos.com/uploads/default/original/3X/0/c/0c19fade8100d43a3eaa779b35b977888495362d.png)

Action to update the GC Entity State (`GCStatus`) when a GC is **Purchased** or **Redeemed**.

**Name:** `AC GC Update State GCStatus`  
**Type:** `Update Entity State`  
**Entity Type Name:** `Gift Certificates`  
**Entity Name:** `[:CertNum]`  
**Entity State Name:** `GCStatus`  
**Current State:** `[:Current GCStatus]`  
**Entity State:** `[:New GCStatus]`

* * *

**Action - Add Line to Text File:** (optional)

![](https://forum.sambapos.com/uploads/default/original/3X/2/5/25177e60d9fa87d64d9910c7828e86f71535dfa6.png)

Action (optional) to `Add Line to Text File`, when a GC is **Purchased** or **Redeemed** , to log any interactions with GCs.

**Name:** `AC GC Add Line to Text File`  
**Type:** `Add Line to Text File`  
**File Path:** `<enter full path, including filename>`  
**Text:** `[:sometext]`

* * *

**Actions - Update Ticket Tags - GCN & GCB:** (optional)

 ![](https://forum.sambapos.com/uploads/default/original/3X/7/e/7e1c6fb30a20ac5bad8aaa9466d471e2817efe4f.png)

Actions (optional) to `Update Ticket Tag`, for `GCN` and `GCB` to use on a Customer Receipt when a GC is used for **Redemption**.

**Name:** `AC GC Update Ticket Tag GCN`  
**Type:** `Update Ticket Tag`  
**Tag Name:** `GCN`  
**Tag Value:** `[:GCN]`

**Name:** `AC GC Update Ticket Tag GCB`  
**Type:** `Update Ticket Tag`  
**Tag Name:** `GCB`  
**Tag Value:** `[:GCB]`

* * *

**Action - Search & Select GC Entity via NUMBERPAD or Scanner:**

![](https://forum.sambapos.com/uploads/default/original/3X/6/2/6297c4b422299ffc842a21cf6749c40d69c471c6.png)

Action to select a `GC Entity` (and associated Account) when a GC number (i.e. `GC2014061315325614520`) is entered into the `NUMBERPAD`, or scanned using a Scanner, for use in **Redemption**.

**Name:** `AC GC Select NUMPAD`  
**Type:** `Change Ticket Entity`  
**Can Create Ticket:** `True`  
**Entity Type Name:** `Gift Certificates`  
**Entity Name:** `[:SearchValue]`

* * *

**Action - Change Entity to “dummy” ZZGC2000:**

![](https://forum.sambapos.com/uploads/default/original/3X/a/d/addd620b4460dc36ef908cd6282465e789b5616e.png)

Action to replace a currently-selected GC that is being used for **Redemption** , when the value of the GC has been depleted (`Balance=0`) during a `Payment Transaction` (when the Ticket is being Settled).

This would replace `GC2014061315325614520` (`value=20`) with `ZZGC2000` (`value=0`) when `GC2014061315325614520` has been used as payment for its entire balance (`20`), and when there is still a Remaining Amount left to be Settled on the Ticket.

The Entity/Account replacement with the “dummy” GC `ZZGC2000` prevents the depleted GC `GC2014061315325614520` from being overdrawn.

**Name:** `AC GC Entity Change to Invalid`  
**Type:** `Change Ticket Entity`  
**Can Create Ticket:** `False`  
**Entity Type Name:** `Gift Certificates`  
**Entity Name:** `ZZGC2000`

* * *

Now we need to capture `Events` using `Rules` and fire the `Actions` we defined.

Let’s get to defining all the **Rules** …

* * *

**Rule - GC Order Added to Ticket - Update States & Transaction Type:**

![](https://forum.sambapos.com/uploads/default/original/3X/8/a/8ad2a9c5838dde0979132cc740c86e47ffde9067.png)

Rule to capture when a GC order has been added to a Ticket, to be **Purchased**.

**Name:** `RU GC Update New`  
**Event Name:** `Order Added to Ticket`  
**Custom Constraints:** Execute rule if `Matches`  
`Menu Item Group Code` **Equals** `Gift Certificates`

**Actions:**

`AC GC Update Order State`  
**Constraint:**  
**Current State:**  
**State:** `Ordered`

`Update Order Gift State`  
**Constraint:**  
**Current Status:**  
**Status:** `Locked`  
**Value:**

`AC GC Update Transaction Type`  
**Constraint:**

* * *

**Rule - Ticket Closing - Update Order State:**

![](https://forum.sambapos.com/uploads/default/original/3X/0/0/00c00a3859d9d84e04a9763e96e1ea2a290e06f8.png)

Rule to capture when a GC order has been Purchased and Paid for (Settled).

**Name:** `RU GC Update Order States`  
**Event Name:** `Before Ticket Closing`  
**Custom Constraints:** Execute rule if `Matches`  
`Remaining Amount` **Equals** `0`

**Actions:**

`AC GC Update Order State`  
**Constraint:**  
**Current State:** `Ordered`  
**State:** `Printed`

* * *

**Rule - GC Purchased & Printed:** (Action in red is optional)

 ![](https://forum.sambapos.com/uploads/default/original/3X/2/0/20cfa5362732cace680242cd3cc879a98479f2b9.png)

Rule to capture when a GC has been ordered, purchased, and printed.

This fires many actions, to create the GC `Entity` & GC `Account`, update its Account Balance and Entity `GCBalance`, print the GC and update the Entity `GCStatus` to **Purchased**.

**Name:** `RU GC Purchased & Printed`  
**Event Name:** `Order State Updated`  
**Custom Constraints:** Execute rule if `Matches All`  
`State Name` **Equals** `Certificate`  
`State` **Equals** `Printed`

**Actions:**

`AC GC Create`  
**Constraint:**  
**Certificate Number:** `[=Helper.GetUniqueString()][=Order.Price]`

`AC GC Purchase`  
**Constraint:**  
**Account Name:** `[=Data.Get("AccountName")]`  
**CertNum:** `[=Data.Get("AccountName")]`  
**Amount:** `[=Order.Price]`

`AC GC Print`  
**Constraint:**  
**DocumentId:** `[=Data.Get("DocumentId")]`

`AC GC Balance Update`  
**Constraint:**  
**CertNum:** `[=Data.Get("AccountName")]`  
**Bal:** `[=Order.Price]`

`AC GC Update State GCStatus`  
**Constraint:**  
**CertNum:** `[=Data.Get("AccountName")]`  
**Current GCStatus:**  
**New GCStatus:** `Purchased`

`AC GC Add Line to Text File` (optional)  
**Constraint:**  
**sometext:** `{DATE} {TIME}, [=Data.Get("AccountName")] ([=Order.Price]), Purchased, Balance [=Order.Price]`

* * *

**Rule - NUMBERPAD Value Entered - Search & Select GC:**

![](https://forum.sambapos.com/uploads/default/original/3X/2/0/20eea70ee21ca5a608bd245776cbb3e13dfb46e2.png)

Rule to capture when a valid GC has been scanned, or its number has been entered into the NUMBERPAD, to Select the GC for **Redemption**.

**Name:** `RU GC Select NUMPAD`  
**Event Name:** `Numberpad Value Entered`  
**Custom Constraints:** Execute rule if `Matches`  
`Numberpad Value` **Starts** `GC20`

**Actions:**

`AC GC Select NUMPAD`  
**Constraint:**  
**SearchValue:** `[:NumberpadValue]`

`AC Display Ticket`  
**Constraint:**  
**TicketId:**

* * *

**Rule - GC Redeemed (used as Payment) - Update GC Data:** (Actions in red are optional)

 ![](https://forum.sambapos.com/uploads/default/original/3X/1/3/13ab09662f0266e5ec898a9c759adf972fda6cbe.png) 

Rule to capture when a valid GC has been used as a Payment Type, to update all the GC Entity Data and GC Account Balance, since it has been used (in whole or in part) for **Redemption**.

**Name:** `RU GC Redeemed (update GC data)`  
**Event Name:** `Payment Processed`  
**Custom Constraints:** Execute rule if `Matches All`  
`Payment Type Name` **Equals** `Gift Certificate`  
`{ENTITY NAME:Gift Certificate}` **Starts** `GC20`  
`[=-1*TN('{ENTITY BALANCE:Gift Certificate}')]` **Greater** `0`

**Actions:**

`AC GC Balance Update`  
**Constraint:**  
**CertNum:** `{ENTITY NAME:Gift Certificate}`  
**Bal:** `[=-1*TN('{ENTITY BALANCE:Gift Certificate}')-[:ProcessedAmount]]`

`AC GC Redeem`  
**Constraint:**  
**Account Name:** `GC Redemptions`  
**CertNum:** `{ENTITY NAME:Gift Certificate}`  
**Amount:** `[:ProcessedAmount]`

`AC GC Update State GCStatus`  
**Constraint:** `[=-1*TN('{ENTITY BALANCE:Gift Certificate}')-[:ProcessedAmount]]<=0`  
**CertNum:** `{ENTITY NAME:Gift Certificate}`  
**Current GCStatus:** `Purchased`  
**New GCStatus:** `Redeemed`

`AC GC Add Line to Text File` _(optional)_  
**Constraint:**  
**sometext:** `{DATE} {TIME}, {ENTITY NAME:Gift Certificate} ([=-1*TN('{ENTITY BALANCE:Gift Certificate}')]), Redeemed [:ProcessedAmount], New Balance [=-1*TN('{ENTITY BALANCE:Gift Certificate}')-[:ProcessedAmount]]`

`AC GC Update Ticket Tag GCN` _(optional)_  
**Constraint:**  
**GCN:** `{ENTITY NAME:Gift Certificate}`

`AC GC Update Ticket Tag GCB` _(optional)_  
**Constraint:**  
**GCB:** `[=-1*TN('{ENTITY BALANCE:Gift Certificate}')-[:ProcessedAmount]]`

`AC GC Entity Change to Invalid`  
**Constraint:** `[=-1*TN('{ENTITY BALANCE:Gift Certificate}')-[:ProcessedAmount]]<=0`

`Display Payment Screen`  
**Constraint:** `[:RemainingAmount]>0`

`Close Ticket`  
**Constraint:** `[:RemainingAmount]<=0`

---

<div class="post-metadata">

**Author:** ![QMcKay](https://forum.sambapos.com/user_avatar/forum.sambapos.com/qmckay/32/27925_2.png) [@QMcKay](https://forum.sambapos.com/u/QMcKay)\
**Post date:** [June 12, 2014, 9:48pm UTC](https://forum.sambapos.com/t/gift-certificate-sales-redemption/1539/2 "2014-06-12T21:48:40Z")

</div>

**GC Tender Button**

This optional setup adds a Button to the Payment Screen to automatically use the Gift Certificate as Payment, tendering a portion of the GCBalance or the entire GCBalance.

**Automation Command - Button for “GC Tender”:**

![](https://forum.sambapos.com/uploads/default/original/3X/8/9/8990530f23b98ce04ac787ea139b2e5bb9f0b0e8.png)

This button is mapped to display on the Payment Screen.

**Name:** `AU GC Tender`  
**Button Header:** `Tender\rGift Cert`

* * *

**Action - Pay Ticket with Gift Certificate:**

![](https://forum.sambapos.com/uploads/default/original/3X/b/5/b50ecf22d88f8676e88941f7e7059faf97c7a76b.png)

Action to Pay the Ticket with the selected Gift Certificate.

**Name:** `AC GC Tender`  
**Type:** `Pay Ticket`  
**Payment Type Name:** `Gift Certificate`  
**Tendered Amount:** `[:GCAmount]`

* * *

**Rule - Tender Partial GC:**

 ![](https://forum.sambapos.com/uploads/default/original/3X/c/a/ca3ca4eb4c3662e42f0e0a9517fcc9280791a519.png) 

Rule to capture the click-event of the **Tender Gift Cert** `Automation Command`, and use a _ **portion** _ of the balance of the GC to Pay the Ticket in full.

**Name:** `RU GC Tender Partial`  
**Event Name:** `Automation Command Executed`  
**Custom Constraints:** Execute rule if `Matches All`  
`Automation Command Name` **Equals** `AU GC Tender`  
`{ENTITY NAME:Gift Certificate}` **Starts** `GC20`  
`[=-1*TN('{ENTITY BALANCE:Gift Certificate}')]` **Greater** `0`  
`[=-1*TN('{ENTITY BALANCE:Gift Certificate}')]` **Greater** `[=TN('{TICKET TOTAL}')-TN('{TENDERED TOTAL}')]`  
`[=TN('{TICKET TOTAL}')-TN('{TENDERED TOTAL}')]` **Greater** `0`

**Actions:**

`AC GC Tender`  
**Constraint:**  
**GCAmount:** `[=TN('{TICKET TOTAL}')-TN('{TENDERED TOTAL}')]`

* * *

**Rule - Tender Total GC:**

 ![](https://forum.sambapos.com/uploads/default/original/3X/9/7/97133f6560e0e8d986df345cbd4c14c9488e5f2d.png) 

Rule to capture the click-event of the **Tender Gift Cert** `Automation Command`, and use the _ **total** _ balance of the GC to Pay the Ticket partially or in full.

**Name:** `RU GC Tender Total`  
**Event Name:** `Automation Command Executed`  
**Custom Constraints:** Execute rule if `Matches All`  
`Automation Command Name` **Equals** `AU GC Tender`  
`{ENTITY NAME:Gift Certificate}` **Starts** `GC20`  
`[=-1*TN('{ENTITY BALANCE:Gift Certificate}')]` **Greater** `0`  
`[=-1*TN('{ENTITY BALANCE:Gift Certificate}')]` **Less** `[=TN('{TICKET TOTAL}')-TN('{TENDERED TOTAL}')+0.01]`  
`[=TN('{TICKET TOTAL}')-TN('{TENDERED TOTAL}')]` **Greater** `0`

**Actions:**

`AC GC Tender`  
**Constraint:**  
**GCAmount:** `[=-1*TN('{ENTITY BALANCE:Gift Certificate}')]`

---

<div class="post-metadata">

**Author:** ![QMcKay](https://forum.sambapos.com/user_avatar/forum.sambapos.com/qmckay/32/27925_2.png) [@QMcKay](https://forum.sambapos.com/u/QMcKay)\
**Post date:** [June 12, 2014, 9:54pm UTC](https://forum.sambapos.com/t/gift-certificate-sales-redemption/1539/3 "2014-06-12T21:54:14Z")

</div>

I will be editing the above posts to include explanations of the various components, and Text-formatted entries for the Printer Template, Rules & Actions so that they may be easily copied/pasted to assist with setup and implementation.

---

<div class="post-metadata">

**Author:** ![JohnS](https://forum.sambapos.com/user_avatar/forum.sambapos.com/johns/32/24916_2.png) [@JohnS](https://forum.sambapos.com/u/JohnS)\
**Post date:** [June 12, 2014, 10:11pm UTC](https://forum.sambapos.com/t/gift-certificate-sales-redemption/1539/4 "2014-06-12T22:11:31Z")

</div>

Great work. You’ve been like a dog with a bone on this 😃

The only issue I can see is in the `RU GC Select NUMPAD` Rule. Change the constraint to `NumberPad Value Starts GC20` otherwise GC’s issued next year will not scan or be accepted via the NumberPad.

---

<div class="post-metadata">

**Author:** ![QMcKay](https://forum.sambapos.com/user_avatar/forum.sambapos.com/qmckay/32/27925_2.png) [@QMcKay](https://forum.sambapos.com/u/QMcKay)\
**Post date:** [June 12, 2014, 11:17pm UTC](https://forum.sambapos.com/t/gift-certificate-sales-redemption/1539/5 "2014-06-12T23:17:10Z")

</div>

Good point @JohnS, about the constraints… they’ve been changed from `GC2014` to `GC20`.

A few reasons for my relentlessness on the GC subject:

- It’s allowed me to learn a great deal about SambaPOS regarding Accounts, Transactions, Document Types, and Automation Actions, Rules & Commands, and Program Settings values, availability (scope) & evaluation.

- We are asked for Gift Certificates here frequently.

- I hadn’t seen a Tutorial for this particular scenario before - you got me started with your implementation, and it’s greatly appreciated. Many thanks to you and @emre!

---

<div class="post-metadata">

**Author:** ![martinmike7](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/m/3ab097/32.png) [@martinmike7](https://forum.sambapos.com/u/martinmike7)\
**Post date:** [July 7, 2014, 1:37pm UTC](https://forum.sambapos.com/t/gift-certificate-sales-redemption/1539/6 "2014-07-07T13:37:22Z")

</div>

This looks great except I’m looking for a way to use plastic gift cards.

Is there a way to change this that instead of using variable gift certificate numbers that I could scan a mag card and assign the scanned number instead? I do not need to print a gift certificate number on the receipt since the customer will be purchasing a plastic card.

Any recommendations on how to use plastic gift cards with SambaPos would be highly appreciated.

Thanks

---

<div class="post-metadata">

**Author:** ![QMcKay](https://forum.sambapos.com/user_avatar/forum.sambapos.com/qmckay/32/27925_2.png) [@QMcKay](https://forum.sambapos.com/u/QMcKay)\
**Post date:** [July 7, 2014, 1:50pm UTC](https://forum.sambapos.com/t/gift-certificate-sales-redemption/1539/7 "2014-07-07T13:50:19Z")

</div>

Nearly anything is possible with SambaPOS, and I don’t see any reason why a mag card couldn’t be made to work with this setup with a few changes.

I don’t have a mag card reader (or programmer), so I can’t tell you what changes would be required. This tutorial will work with a barcode scanner so I assume a mag card would be similar, but I don’t have the details.

You would need to figure out the format of the information on the mag card, and still likely need store the card ID (or similar) along with the remaining balance within SambaPOS, unless you have the capability to update the balance on the card itself.

There is a similar Tutorial here, but I don’t think it uses mag cards either:  
[http://www.sambapos.org/en/content/sambacard-tutorial](http://www.sambapos.org/en/content/sambacard-tutorial)

---

<div class="post-metadata">

**Author:** ![martinmike7](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/m/3ab097/32.png) [@martinmike7](https://forum.sambapos.com/u/martinmike7)\
**Post date:** [July 7, 2014, 1:57pm UTC](https://forum.sambapos.com/t/gift-certificate-sales-redemption/1539/8 "2014-07-07T13:57:22Z")

</div>

Thanks for the quick response QMcKay!

The cards do not store the balance this would need to be stored in SambaPos just like the above solution.

I do have the option of getting a barcode printed instead of a mag strip and have seriously considered this instead. I don’t need to worry about the mag strip not working or getting damaged.

I am really wanting to use SambaPos and have learned a lot in the recent weeks trying to set it up. I am stuck on the gift card solution. If you or anyone have any additional help on what changes I would need to make to get the above to work. I am fine using cards with bar codes instead of the mag strip.

Thanks again

---

<div class="post-metadata">

**Author:** ![QMcKay](https://forum.sambapos.com/user_avatar/forum.sambapos.com/qmckay/32/27925_2.png) [@QMcKay](https://forum.sambapos.com/u/QMcKay)\
**Post date:** [July 7, 2014, 2:05pm UTC](https://forum.sambapos.com/t/gift-certificate-sales-redemption/1539/9 "2014-07-07T14:05:50Z")

</div>

I guess what you would be asking to do then, is to be able to scan a new card and have it store the card ID and value automatically when you sell the card. Someone with the proper equipment will need to assist, since I have no way to test.

Then when a customer returns with the card, the rest of the setup will be very much the same.

---

<div class="post-metadata">

**Author:** ![martinmike7](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/m/3ab097/32.png) [@martinmike7](https://forum.sambapos.com/u/martinmike7)\
**Post date:** [July 7, 2014, 2:09pm UTC](https://forum.sambapos.com/t/gift-certificate-sales-redemption/1539/10 "2014-07-07T14:09:35Z")

</div>

Thanks QMcay, that is exactly what I’m asking.

Thanks so much, hopefully someone can assist!

---

<div class="post-metadata">

**Author:** ![QMcKay](https://forum.sambapos.com/user_avatar/forum.sambapos.com/qmckay/32/27925_2.png) [@QMcKay](https://forum.sambapos.com/u/QMcKay)\
**Post date:** [July 7, 2014, 2:14pm UTC](https://forum.sambapos.com/t/gift-certificate-sales-redemption/1539/11 "2014-07-07T14:14:53Z")

</div>

In the Tutorial when I make mention of the `{:NUMBERPAD}` or `[:NumberpadValue]`, I am actually referring to reading a card ID using a scanner, since when you scan something, the value is transferred into the NUMPAD field (just above the numeric keypad) by default.  
However, this is for redemption, not for purchase, but it could be made to work both ways.

Additionally, we need to know the format of the card ID so that we can change any mention of `GC20` in the tutorial to something that matches a common part of the card ID.

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [July 7, 2014, 3:22pm UTC](https://forum.sambapos.com/t/gift-certificate-sales-redemption/1539/12 "2014-07-07T15:22:43Z")

</div>

One SambaPOS user uses these mag cards. These cards are pre-programmed with unique values that displayed on front. (JK001502). When asked card manufacturers does it.

When they want to give a new card to a customer they create a new card entity by scanning card number.

 ![](https://forum.sambapos.com/uploads/default/original/3X/4/d/4d6b6890b48c8dcaf6768cb9e5463fdb921a645d.jpeg) 

[http://www.sambapos.org/en/content/sambacard-tutorial](http://www.sambapos.org/en/content/sambacard-tutorial) prepared to implement similar solution.

---

<div class="post-metadata">

**Author:** ![martinmike7](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/m/3ab097/32.png) [@martinmike7](https://forum.sambapos.com/u/martinmike7)\
**Post date:** [July 7, 2014, 3:54pm UTC](https://forum.sambapos.com/t/gift-certificate-sales-redemption/1539/13 "2014-07-07T15:54:44Z")

</div>

Hi emere, the SambaCard seems like it would work but I’m a little confused on the sale of it. I am looking to sell gift cards. I would need to have an item, can be set amounts such as $10, $20, $25 etc. The customer would purchase these as a sale. So I would need to be able to print a receipt and have them in a separate account to track. I do not want them counting as a sale twice for tax reasons. When they are redeemed they are charged sales tax but not at the purchase of the card.

With my printer I can get them printed with either a bar code or a mag strip.

QMcKay, as far as the number sequence I was thinking HGC10000001 etc. I think I know how to change that in the tutorial I am just not sure how to change it so that I scan the card and assign that card to a dollar amount. I am not interested in creating a customer account since most of our gift card sales are for gifts to someone else. So I don’t need the customers name etc. I just need to have the card number stored and the assigned dollar value to it.

Later a customer presents that card. We scan it and then know the balance and can assign it to the sale.

Hope this makes sense. Thanks for all the help!

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [July 7, 2014, 10:03pm UTC](https://forum.sambapos.com/t/gift-certificate-sales-redemption/1539/14 "2014-07-07T22:03:50Z")

</div>

@martinmike7 Did you reviewed our Promotion Coupon documentation? [http://sambapos.org/wiki/doku.php/en/preparing\_sambapos\_to\_sell\_coffee\_coupons](http://sambapos.org/wiki/doku.php/en/preparing_sambapos_to_sell_coffee_coupons) sample demonstrates how to automate item sales to create coupon entities. You can use same mechanism to create card entities and also create account transactions to load credits to card accounts.

You can configure tax rates (or does not configure a rate for a specific product group at all) through tax configuration. For example this tax rate will only work for listed product groups.

 ![](https://forum.sambapos.com/uploads/default/original/3X/2/3/23bdf2c451dc901fd921cb30d71865f5df4ff75f.jpeg)

---

<div class="post-metadata">

**Author:** ![martinmike7](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/m/3ab097/32.png) [@martinmike7](https://forum.sambapos.com/u/martinmike7)\
**Post date:** [July 7, 2014, 10:42pm UTC](https://forum.sambapos.com/t/gift-certificate-sales-redemption/1539/15 "2014-07-07T22:42:10Z")

</div>

Yeah Emre I have reviewed it. I guess I’m struggling with how to best implement this whole process.

1. Customer purchases a gift card. We process the sale and scan the card to associate the card with the credit that was purchased. It should be in a separate account from sales so it is not counted twice when the card is used.
2. Customer who received the gift card uses it to purchase food. Remaining balance is kept in system for future use. Customer can also add money (credits) to the card.

My thoughts, if possible, to have a popup window telling the cashier to scan the card after the purchase of it.

I will keep trying to figure it out. Any more input would be greatly appreciated.

Thanks

---

<div class="post-metadata">

**Author:** ![allmixedup](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/a/90db22/32.png) [@allmixedup](https://forum.sambapos.com/u/allmixedup)\
**Post date:** [August 14, 2014, 2:53am UTC](https://forum.sambapos.com/t/gift-certificate-sales-redemption/1539/16 "2014-08-14T02:53:45Z")

</div>

@martinmike7

i am trying to do the same thing what you are.

Here is the step should be.

1. cashier press the **New Gift Card** button and a number pad should popup
2. cashier can swipe the card via mag reader Or enter the card # manually using the pop up number pad
3. cashier can press **ADD FUND** button and number pad pop up so cashier can enter then amount.
4. cashier receive payment from the customer ( Cash , Credit, in house account, …)
5. receipt print with showing transaction amount and last 4 digit of the card # at the bottom of the amount line.
6. in the account screen gift card account shows $ amount, what ever amount customer paid the gift card. of course no tax on it
7. a entity is created in entity list with full card # , also account should be automatic created under that gift card # for tracking purpose ( spending and reloading)
8. customer purchase item and pay with gift card, cashier ring up the sales and press either settle button or fast giftcard payment button A numberpad will pop up and cashier swipe the card or enter the card # ( in case if mag strip is bad)
9. Sambapos now check the card balance and applied towards to the purchase amount. if purchase amount is bigger then card balance then it will apply whole amount and due message should pop up and customer pay rest of the balance with cash or credit or … (split tender)  
10 gift card account should debited (1 entire gift card account and another card # account, in accounting term i should say credited) and reflect the new balance.

now customer come back and want to reload the card

1. cashier press the **Reload Gift Card** button and number pad pop up, cashier swipe the card or enter the #
2. Gift card balance shows up on the screen also **ADD FUND** button should be there on the same screen
3. cashier now do the same process from step # 3

@ Emre , JohnS , QMcKay or any one who knows how to create all this step or some of them please write here and we all can make nice Tutorial for this so other people can configure their SambaPOS to sell gift card. 🙂

Tom  
Just setup SambaPOS to run over the internet. if any one want to set it up i can help 🙂

---

<div class="post-metadata">

**Author:** ![QMcKay](https://forum.sambapos.com/user_avatar/forum.sambapos.com/qmckay/32/27925_2.png) [@QMcKay](https://forum.sambapos.com/u/QMcKay)\
**Post date:** [August 14, 2014, 4:12am UTC](https://forum.sambapos.com/t/gift-certificate-sales-redemption/1539/17 "2014-08-14T04:12:23Z")

</div>

This GC Tutorial was over a month in the making, without mag-readers, QR/BAR readers or anything else. Everyone’s business plan and operational flow is different; their equipment is different, their needs are different; their capabilities are different depending on the equipment.

The approach I took when I wanted the GC solution that worked for me:

Read, read read: I read tutorials on promotions, gifts cards, coupons; anything I could find.  
Presented my usage scenario.  
Someone (@JohnS) posted a simple tutorial that was somewhat close to what I wanted.  
Going back and forth with the gurus, I came up with this tutorial, which was perfect for my needs: no scanner equipment needed, no double-billing or double-sales.

But I built it myself with some guidance; by reading and asking questions.  
@JohnS gave me a head start on the basics, then through _ **experimenting** _ and Q&A, I have the perfect result… for my needs.

**Here is the value:**  
The exercise gave me insight into the way SambaPOS works.  
It revealed to me that nearly anything is possible.  
I can answer questions and reveal solutions for nearly any scenario, since for the most part, I get it, because I struggled with it and learned.

I didn’t do it alone, but I didn’t use a canned solution either. Nothing is going to work for everybody. That’s what you need to take from this. Start with the basics and expand.

**The `Show Message` action is your friend: it will reveal secrets, success or failures.**

You need to give it a go, experiment, and ask questions. No one is going to do it for you. And I repeat…

**Here is the value:**  
The exercise gave me insight into the way SambaPOS works.  
It revealed to me that nearly anything is possible.  
I can answer questions and reveal solutions for nearly any scenario, since for the most part, I get it, because I struggled with it and learned.

I apologize if this sounds like a rant. It’s not. You won’t get what you want unless you do it yourself.

Maybe I’ll feel better in the morning.

---

<div class="post-metadata">

**Author:** ![martinmike7](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/m/3ab097/32.png) [@martinmike7](https://forum.sambapos.com/u/martinmike7)\
**Post date:** [August 22, 2014, 12:58am UTC](https://forum.sambapos.com/t/gift-certificate-sales-redemption/1539/18 "2014-08-22T00:58:25Z")

</div>

Hi QMcKay,

I understand what you are saying, and delving in and learning everything would be useful. But many of us, myself included are extremely busy running our restaurant, updating social media, our websites and then spending time with our families. It can be very difficult to find the time to learn a whole new system and try to implement it. I would love to get Sambapos to a point of being able to use it but I just don’t have the time and would be more than willing to pay for someone to set it up.

Maybe this sounds like a rant but I just don’t have the time to delve in as deep as maybe it takes to learn Sambapos.

I really think that there should be an option to pay to have it setup to a users specifications or needs. I think there may be many like myself willing to pay to have it be usable in my restaurant.

Mike

---

<div class="post-metadata">

**Author:** ![Jesse](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jesse/32/61493_2.png) [@Jesse](https://forum.sambapos.com/u/Jesse)\
**Post date:** [August 22, 2014, 1:01am UTC](https://forum.sambapos.com/t/gift-certificate-sales-redemption/1539/19 "2014-08-22T01:01:33Z")

</div>

There is nothing stopping people from accepting payment to set it up for you. I doubt you will get it from the developers however. I see a future where there will be many services offered to setup sambapos. Heck I may even do some of it. Reason you do not see a lot of it yet is many people are still learning it. It is also a unique platform that pretty much has its own market that is still developing. There are plenty of other POS software solutions that offer pay per month etc. But even with the support they will not do what SambaPOS can do.

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [August 22, 2014, 3:13am UTC](https://forum.sambapos.com/t/gift-certificate-sales-redemption/1539/20 "2014-08-22T03:13:10Z")

</div>

I know I won’t be able to express my thoughts fine because of my language barriers but I’ll try to do my best. What we’re aiming to do with SambaPOS is creating an automation tool that perfectly fits to “ **your** ” business workflow. Most POS software built on best practices and have lots of features to configure it to restaurant’s needs. However they have their “ **own** ” workflow designs so even they offer zillions of settings after one point restaurant managers should follow what their POS system predicates. In fact this is good for restaurants if they switched to a POS system from pen & paper since it quickly improves efficiency and teaches how to operate a restaurant business… All POS solutions can already solve that but this is not what really needed.

Should a restaurant business operate as what POS developers thinks right or should it operate as your business needs? Of course I have my own ideas but other than security issues we rarely talk about how a restaurant business should operate. Do you believe it? We’re a POS developer team who never says “you don’t know how to do it” or “this is not right” to their users. We believe even it is the worst looking idea managers should be able to align software to their business because every businesses has their own reality.

But the real issue we’re dealing with is “realities changes”. For example think of you found a great promotion idea but your POS system does not allow doing that… This is what we are trying to solve. So setting up SambaPOS once is not enough. You should be able to improve your POS system as your business improves. That’s why understanding it and contributing to its development is important. As more people understands it and talks about their needs SambaPOS greatly improves. Old SambaPOS’ers knows that. Every new release brings unrelated features but at one point these feature pieces works together to solve most related issues. That’s why new SambaPOS features generally opens new possibilities.

I just wanted to tell you the reason of why people constantly recommends you to do it on your own way. I know %80 will still prefer pro support and stick to best practices but people who gets the idea will always have more powers on competition.

Finally @QMcKay sorry for typing off topic under your tutorial.

[Next page](https://forum.sambapos.com/t/gift-certificate-sales-redemption/1539.md?page=2)
