E-COUPONS / E-CREDIT LINES

SendSafe fully supports e-coupons and e-credit lines. E-Coupons operate in the same way as a physical coupon. All e-coupons require the entry of a coupon code by the customer. Coupons are not intended as substitute for store-wide sale pricing of items (see discount, BXGY sale pricing, quantity pricing, and special sale pricing for those requirements).

Businesses can include a coupon code in advertisement and instruct the customer to enter the code. This is a naturally understood process for using a coupon whether online or in a brick and mortar store; so this type of promotion will not be confusing to a customer. Customers will have experienced this kind of coupon redemption process in e-stores from Amazon to iTunes.

E-coupons can be manually created in any number of ways (including the use of an coupon import tool) but the true power of SendSafe e-coupons exists in SendSafe's ability to automatically issue coupons.

E-Coupons can be automatically issued when an event occurs such as a customer buying a certain product (Rewards Programs) or periodically (for example) the 15th day of each of month; see Automatic Issuing of e-coupons for more information. This auto-coupon customer reward program which issues coupons automatically after purchase is one of the oldest and most successful sales tools in SendSafe. Auto-coupons have been in SendSafe for about 14 years and are responsible for a huge volume of return business for e-stores that employ them. They make your e-store stickier.

Coupons are defined in the {Coupon} database table. Review this Db table before attempting to issue coupons. E-Coupons definitions are entered into the system via the SendSafe E-Coupon WebAdmin page. The definitions can be created by the SendSafe Robot or they can be entered using a 3rd party program that inserts them into the database (this means that any program with SQL access can create e-coupons).

There are two fundamentally different kinds of coupons:

Coupons are issued or handed out in two different ways:

To use a coupon the customer enters a coupon number into the Billing Information Order Form or into the IHC credit card field (if the coupon is to be used for an In-house credit line). The SendSafe system also supports store wide sales in the form of Buy 1 Get 1 Free sales which do not use coupons.

Validation of coupons are performed twice, once by both the Web Page GUI and once by the Robot. If the coupon is for the full amount of the order, then the customer does not need to enter a credit card (see also User Entry Help).

Validation of IHC charges is performed once by the Robot after submission of the order.

When an e-coupons is used by a customer, the total cost displayed on the billing information page will be adjusted for the coupon (if the coupon can be validated). This discount is an estimated value and under some circumstances involving "shared coupons" this estimated value may not be correct. If two people are using the same coupon at the same time and there is only one use left, then the two orders will be in a race condition (where the 1st coupon processed by the Robot will win). If you do not issue shared-use coupons then the displayed value will alway be correct.

Coupon entry by customer:

The customer can enter coupons by typing them into the appropriate entry field OR by selecting from a dropdown list of available coupons. The coupon dropdown list appears directly below the coupon entry field. This list will contain all coupons which were specifically issued to this customer. The list will not contain generic coupons. If the customer has no specifically issued coupons then the list will be empty. Coupons are included in the list based on the following SQL:

select top 50 couponnumber from 
coupons where 
active = 1 and 
usesleft > 0 and 
RemainingDollarValue > 0 and 
CouponTemplate = 0 and 
BeginDate <= CAST( getdate() AS datetime) and 
EndDate >= CAST( getdate() AS datetime) and 
issuedto = 
(
select email from customers, addresses where 
customerid = 111111111 and 
customers.addressid = addresses.addresscodeid
)

Coupons can be configured to be three different types:

All coupons have several control characteristics specified in the database and the Web Admin Page:

QuickBuy Coupons - Auto-applied Coupons

QuickBuy E-Coupons are a special class of coupons which are automatically applied to an order. QuickBuy E-Coupons are not related to QuickBuy credit one click instant checkout transactions. QuickBuy coupons are linked to a specific customer by either the IssuedTo email address matching the email address entered by the customer or by the CodeDescriptor matching the customerid.

A customer can chose to use a different coupon code then a QBC code, but if a QBC is present it will preclude placing an order without some coupon code. The customer can use an invalid or null code, if they do not want to use any coupon (when a QBC is present).

QuickBuy E-Coupons are setup as follows:

Note: You must have customer record linkage by either IssuedTo or CodeDescriptor.

If the email address matches but the "QBC" reserved word is not present in the CouponNumber, then the e-coupon will be listed in a dropdown BUT not automatically applied.

Details and Internals

Sales Tax and E-Coupons

Sales Tax is handled differently for e-coupons verses e-credit lines. Coupons are not treated as a cash substitute. Coupons are treated as a price discount. The implication is that less sales tax will be charged on items which have recieved a price discount. IHC E-Credit lines are treated as cash and sales tax is applied appropriately.

More info on sales tax.

E-Coupons: The logic that implements the sales tax for coupons uses a ratio-metric calculation of sales tax by applying to the sales tax the same discount-ratio for which a coupon is applied to line items. i.e. if a coupon results in an 80% discount on an order’s line items THEN total sales tax for that order is also reduced by 80%. The ramifications of this logic is that some coupons when applied to split orders can result is an average reduction of all sales taxes (and does not take into account the specific sales tax that was applied to any one specific item).

IHC E-Credit Lines: Since IHC E-Credit Line is treated as a different brand of credit card, sales tax is calculated the same as with any other credit card.

E-Coupons used as a simulated Credit Lines: Some websites use coupons as a form of credit line. Sales tax is treated as a line item to which the simulated credit line must fulfill. Simulated Credit lines are distingued from e-coupons by the presence of the keyword ECREDITLINE in the RequiredDiscountPlan field.

E-Coupon Simulated E-Credit Line

Using E-Coupons as a simulated credit line requires the creation of one coupon for each credit line. Since this is simulated credit line there are differences in how it is handled compared to an IHC (real) credit line. The simulated credit line is treated as a discount (not as cash) in the accounting records; any credit charge which was performed one the same order will be treated as cash. The saved and displayed total amounts of the order (the amount charged) will be zero for all orders for which the simulated credit line is the sole form of payment and not additional credit charge was made. To calculate the material cost of a sim credit line order will be the totalamount + couponadjustment.

Sim credit lines differ from IHC E-Credit Line in that sim credit lines can be combined with other methods of charging including IHC. Sim credit lines cannot be combined with e-coupons including QBC coupons (where IHC can be combined with e-coupons).

Sim E-Credit lines require the following fields in an e-coupon in addition to normal coupon field usage:

Automatic E-Coupon Simulated E-Credit Line

Using Automatic E-Coupons (AEC) as a simulated credit line requires the creation of one coupon for each credit line. The coupon number is NOT entered into the e-coupon field or quick buy instant checkout. Since this is simulated credit line there are differences in how it is handled compared to an IHC (real) credit line. The simulated credit line is treated as a discount (not as cash) in the accounting records; any credit charge which was performed one the same order will be treated as cash. The saved and displayed total amounts of the order (the amount charged) will be zero for all orders for which the simulated credit line is the sole form of payment and not additional credit charge was made. To calculate the material cost of an AEC order will be the totalamount + couponadjustment.

AEC differs from IHC E-Credit Line in that AEC can be combined with other methods of charging including IHC and AEC works automatically and invisibly. AEC cannot be combined with e-coupons including QBC coupons (where IHC can be combined with e-coupons).

AEC differs from non-automated E-Coupon Simulated credit lines in that AEC forces the credit line to be used for all purchases and the non-automated E-Coupon Simulated credit line does not force use of the credit line. However, if a non-automated credit line is setup as as QBC coupon then there is very little difference (except that the QBC coupon can be replaced by the customer with a different coupon code or a null code if desired.

AEC coupons are linked to a specific customer by either the IssuedTo email address matching the email address entered by the customer or by the CodeDescriptor matching the customerid.

AEC E-Credit lines are setup as follows:

Note: You must have customer record linkage by either IssuedTo or CodeDescriptor.

Automated E-Credit lines do not use the following fields in an e-coupon:

IHC E-Credit Line

Using E-Coupons for in-house credit lines (IHC) requires the creation of one coupon for each credit line. The coupon number is entered into the IHC account number field on the billing page.

E-Credit line account numbers MUST included 10 or more numeric digits. They can also include the letters A-Z, in addition to the minimum 10 numeric digits. Failure to include 10 numeric digits or more will result in a bogus credit card rejection event. This length requirement is set by Application("IHCCardNumLen" ).

In addition to the Account number a Security Code or PIN is also required (i.e. "back of the card" security code for Visa/MC). This code is setup in the system in the coupons.CodeDescriptor field. This field must only be numeric and leading zeros are illegal.

E-Credit lines require the following fields in an e-coupon:

E-Credit lines do not use the following fields in an e-coupon:

If your orders are being processed through the credit card processor instead of IHC, check to make sure you have set CSV CODE = YES.

Creating E-Coupons

To create a coupon you must either use the Web based Coupon Admin page or make a direct entry in the {Coupon} table using a 3rd party tool or program. It is recommended that you use the Coupon Admin Page. If at all possible only issue coupons with a single use (i.e. UsesLeft = 1). This will result in more secure coupon operation since stolen or shared coupons will not be able to be used if the rightful recipient has already used it.

A coupon will not be enabled until the Active field is set to one (1) and the Uses Left is set to some positive value. 

Note: If manually entering coupons into the database... all fields in a coupon record must be set to a value... Null fields will be reported as an invalid coupon record during processing an order that uses the coupon.

You must set a maximum dollar amount for a coupon (see TotalDollarValue and RemainingDollarValue). The Remaining Dollar Value will be decreased with each use of the coupon until the value of the coupon is used up. This RemainingDollarValue field can be used to report and track dollar use of coupons. 

Note: To make a non-expiring coupon: UsesLeft should be set to a very large number to make sure that a coupon never runs out of uses and the begin and end dates should be set for a long enough period of time.

E-Coupons Limiting Flags

In addition to flagging coupons as good only for specific products, the entire option of entering coupons can be turned on/off by the presence of an e-coupon limiting flag. This flag is located in the OrderLineItem.OrderFlags column. If the flag "LIMEC" is found in the orderlineitem then the coupon entry fields are turned off for this order. The "LIMEC" flag can be placed in an lineitem in a number of ways. The most common way is to insert it into the order by using an ORDERFLAGS entry field in the addToBasket FORM POST operation: i.e. <INPUT TYPE=hidden name="ORDERFLAGS" value="LIMEC">

E-Coupons Issued by Robot

Approximately every hour, the robot issues e-coupons that have been created using the Coupon Admin Page or other automated processes. When a coupons is issued the following things occur:

To be issued, a coupon must meet the following coditions:

*Note: If the robot is operating in backup mode then it will not issue e-coupons.

Coupon Price Discount Calculation

The discount value of a coupon is applied to the full cost of an item including any shipping charges. This means that a coupon valid for one free item would include shipping costs. A coupon good for 10% off would have 10% taken off the total cost of the item including shipping costs. The result of this logic is that orders which include coupons are calculated in a way that yields results as if the steps listed below were used:

  1. Total All items
  2. Calc shipping
  3. (Optional) calculate portion of shipping applicable to the coupon
  4. Apply coupon
  5. subtotal order
  6. Calc sales tax
  7. Total order

*Shipping charges which are calculated based on the total order will have the coupon applied ratio-metrically to the shipping cost. For shipping cost based on total order amount, the shipping charges will be a straight percentage of the dollar amount of the validated items verses unvalidated items. For UPS and other shipping cost calculations which are nonlinear weight + distance based, the shipping charges will be a straight percentage of the total weight of the validated items verses unvalidated items.

**The actual software logic that totals orders and applies coupons does not follow the discrete accounting steps listed above (but instead uses different methods to arrive at a like result). This departure in methods is due to how coupons are applied and how shipping charges and sales tax must be calculated for split orders which ship to different states with different sales tax ratios and different shipping costs. The logic that implements the (above) accounting steps uses a ratio-metric calculation of sales tax by applying to the sales tax the same discount-ratio for which a coupon is applied to line items. i.e. if a coupon results in an 80% discount on an order's line items THEN total sales tax for that order is also reduced by 80%. The ramifications of this logic is that some coupons when applied to split orders can result is an average reduction of all sales taxes (and does not take into account the specific sales tax that was applied to any one specific item).

The order of precedence for coupon discounts is:

  1. BuyX - GetN free
  2. Percentage Discount
  3. Remaining Dollar Amount

The precedence comes into play in controlling how a discount will be applied. If you set both "BuyX-GetX free" and a Percentage, then the "BuyX-GetX freee" will be applied and the Percentage will be ignored (with the total remaining dollar amount limiting the upper value of the coupon). If you do not set "BuyX-GetX freee" or a Percentage, then the full remaining dollar amount of the coupon will be used as a discount. It is very important to understand this order of precedence when creating coupons.

Use the following values to disable a discount mode:

  1. BuyX - GetN free: Set BuyX = 0
  2. Percentage Discount: Set Percentage = 0
  3. Total Dollar Amount: Set dollar amount = -1 (warning: setting total dollar amount = -1 will create a coupon with no upper limit to its dollar value. Set this value to -1 only if you want the coupon to be good for any amount; otherwise it is good practice to set the Dollar Amount to some upper limit, unless the coupon is a percentage coupon and good for a percentage of the order regardless the total order amount.) This option does not apply to Simulated Credit lines. Setting this value to -1 will disable subtraction of coupon dollar usage form the Remaining Dollar Amount.

Coupons for Specific Products

Selecting products restrictions by type: The ValidateProductTypes field in the database contains the product types for which this coupon is valid. The ProductType field in the {Items} table establishes a product's type. This ProductType is compared to the list of ValidateProductTypes of a coupon to ascertain if a specific product is valid with this coupon. 

Selecting product restrictions for specific products: The ValidateProductTypes field in the database lists ItemCodeIDs (in <brackets>) for which this coupon is valid.

For all coupons except BuyX GetN free, you can have a mixed selection of both "By Type" and "Specific Products". See the ValidateProductTypes database information for specific examples of constructing these lists.

Note: You must set the ValidateProductTypes to the string "<any>" (no quotes) if you want all products to be covered by a coupon.

Note: SendSafe can be run in a mode where it will process all coupon orders, but reject all credit card charges. This mode (meant primarily for site development testing) can also be used to create a site that accepts only coupons. The robot is placed in this mode with a -D command line switch.

Quota Restricted Coupons

Quota Restricted Coupon functionality links a shopping-list of products which must be purchased before the coupon can be used for other products in the store. Quota Restricted Coupons allows you to create an unlimited number of "shopping lists" called quota-lists. There are two parts to a quota restricted coupon: the "shopping list" and the coupon itself.

Quota Restricted Coupons use a database table to define the list of product with quotas which must be purchased before the full value of a coupon is unlocked. Products with quota requirements MUST be previously purchased before products without quota requirements can be used with this coupon.

Quota-Lists are defined in the Storefront Admin page (v2.adminstoreconfig.asp). You can have one or more products in a Quota-list. A quota list is named by the value entered into the keyword column of the storeconfig Db table (see illustration below). You can have an unlimited number of different Quota-lists by giving them all different names (keyword values).

Important Limitation: The requirements checker DOES NOT include items in the current order toward any quotas since these items have not been purchased yet.

The table columns for a quota-list are defined as follows in the storeconfig admin page:

This is an example of a Quota-List:

The entry line(s) which contains quantity = 0 (and in this case "<any>") is an entry which designates which products can be purchased with this coupon once the quota is met and the coupon is unlocked. Products without quotas are designated by setting the quota (value2) = 0.


ONLY non-quota products will be usable for this coupon once the quotas are met and the coupon is unlocked. Items in a quota-list with quotas > 0 ARE NOT usable with a coupon UNLESS they are also included elsewhere in the list (as non-quota products) without a quota (i.e. quantity=0).

In the above example, once quotas are met, any product including quota products can be purchased because the only non-quota product in the list is <any> (i.e. anything). If instead of <any>, we had entered some SKUS in the above example, THEN once quotas are met, ONLY those non-quota SKUS would be usable with the unlocked coupon.

Note: To setup Quota Restrictions, you must have a table to hold your quota list(s). Quota lists are stored in the "Coupon Rules" table. If you do not have a "Coupon Rules" table, you can add one by entering "Coupon Rules" into the "Add Table Name" field when adding the first record for your quota-list (see illustration below).

Alternate use: Quota lists can be used as a "control restrictions" for any coupon. You can change any number of coupons by changing a single entry list. To use a quota list in place of the standard ValidateProductTypes list, do the following:

  1. Enter the SKU for the product into the keyword column.
  2. Enter a very large number for the quota in value2 (i.e. 9999999 would be a good number to use)

 

BXGY Trial Promo Coupons

BXGY Trial Promo Coupon functionality links a shopping-list of products which when one of the items is purchased a paired item is automatically (silently) added for free to the order. BXGY Trial Promo Coupons use a database table to define a list of BXGY product pairs.

BXGY-Lists are defined in the Storefront Admin page (v2.adminstoreconfig.asp). You can have one or more products in a BXGY-list. A BXGY list is named by the value entered into the keyword column of the storeconfig Db table (see illustration below). You can have an unlimited number of different BXGY-lists by giving them all different names (keyword values).

The table columns for a BXGY-list are defined as follows in the storeconfig admin page:

This is an example of a BXGY-List:

Note:

Note: If you do not have a "BXGY Rules" table, you can add one by entering "BXGY Rules" into the "Add Table Name" field when adding the first record for your bxgy-list (see illustration below).

E-Coupon Grace Period

There is a 48 hour grace period applied to all coupon end dates. This grace period exists partially to provide time for customers in different date zones to use what is still a valid coupon in their date zone (while the web server at its date zone would otherwise see a coupon that has expired).

This grace period of 48 hours is added to the End date of the coupon. The grace period is not displayed in the e-coupon that is e-mailed to the customer. In a future release of SendSafe the grace period will be configurable in 1 day units of time.

E-Coupon Ownership Linkage

Coupons are owned by a specific customer when the IssuedTo email address matches the email address entered by the customer and the CodeDescriptor matches their customerid.

Any coupon which has the CodeDescriptor set to the keyterm "{CID}" will have the user's customerid insterted into that coupon upon first use.

Establishing ownership is very useful. Once ownership is established, the coupon will appear in the MyAccount page showing current balance. The coupon will also appear in the dropdown list on the billing checkout page making selection much easier.

Gift Certificate E-Coupon Purchasing

This is feature is used to setup the purchase of single user unique E-Coupons as gift certificates.

Gift certifcates are not generated for orders with a zero dollar amount. This rule prevents coupons or gift certifciates from being 100% used to buy gift certificates.

The purchase of an item which is linked to an auto-coupon template will result in the generation of a unique e-coupon matching the template. An auto-coupon template is a coupon record with the AutoCoupon and Coupon Template check boxes checked. The E-Coupon WebAdmin page is used to create auto-coupon templates as well as individual e-coupons.

An E-Coupon is generated when a matcing product is purchased. A product is matched (i.e. link) to an autocoupon by using in either the AutoCouponProductId or AutoCouponProductType fields of an auto-coupon template. The e-coupon will be immediately issued to the customer that made the purchase once their credit card has been authorized. A single order can result in multiple e-coupons if several matching items are purchased. Additionally, a single item purchased can result in multiple e-coupons if the item is listed in more than one auto-coupon template.

Recommendations and options:

Rules:

  1. The template coupon number must have a prefix = "GIFT-". If this prefix is not used, the autocoupon will not save CouponNumbers to the orders lineitems
  2. Unless deplex its lineitems is setup, and the customer ordered more than one of a matching item then the system will issue a single coupon worth "One Coupon Unit Value" per Item ordered, instead of issuing multiple individual coupons. For example: If the autocoupon template had a TotalDollarValue of $10 and the customer ordered 5 matching items then coupon issued to the customer would have the autocoupon template value of TotalDollarValue increased to $10 x 5 = $50.00.
  3. If the RequiredDiscountPlan is set to a value other than null then the customer must be a member of that discount plan to recieve this auto-coupon with the exception of the reserved word ECREDITLINE which indicates special sales tax handling and/or simulated credit lines.
  4. The Beginning date for the coupon is set to the date that the order was placed.
  5. The ending date for the coupon is set to the difference in days between the beginning and ending dates as set in the autocoupon template.
  6. The contents of the CodeDescriptor from the template is inserted into the codedescriptor field for each autocoupon that is created. Setting this field to {CID} will result in the user's customerId bein insterted into this field upon first use.
  7. Auto-Coupons will not be issued for items which have a zero dollars value.
  8. Auto-Coupons will not be issued on orders where the entire coupon and sale adjusted cost of the order is zero.
  9. Auto-Coupons will not be emailed if the IssuedTo field is set to "NOSEND@".
  10. If the IssuedTo field is set to "NOSEND@" the coupon will not appear in the buy's MyAccount until and unless the coupon is used by the buyer. This is actually desirable for gift coupons which are to be given to someone other than the buyer.
  11. Set IssuedBy = NULL to suppress admin emails being set to confirm generation of the coupon.

Notes:

Printing
The gift cards can be printed for each order. You will find a print gift cards button at the bottom of the order admin page and the accounting report page. This print function is designed to print the coupon number onto a preprinted card or ouput to a file. In HTML output mode tThe system will send a new page command to the printer after each coupon number is printed. The positioning of the coupon number on card is controlled by storeconfig entry defined as follows:

Note: To setup printing, you must have a "Gift Card" table in the storefront. If you do not have a "Gift Card" table, you can add one by entering "Gift Card" into the "Add Table Name" field when adding your "coupon number position" record.

The output modes are HTML, ASCII, and XLS. In ASCII mode a file is rendered in the browser which can be copied and pasted into a spreadsheet. In XLS mode an Excel XLS file is created and saved to the disk. In HTML mode a printable HTML file is rendered in the browser.

WARNING: XLS mode ONLY WORKS with Internet Explorer and only if Excel is installed on the host computer.

Note: To setup printing modes, you must have a "Gift Card" table in the storefront. If you do not have a "Gift Card" table, you can add one by entering "Gift Card" into the "Add Table Name" field when adding your "output mode" record.

Rewards Programs - Automatic issuing of e-coupons

SendSafe can automatically issue coupons using two different mechanisiums:

A reward program is configuring the system to email out single use coupons after a specific type of purchase. This process can be immediate OR a coupon job can be used to send out coupons after 1 week or once a month or any other scheme you like. Automated issuing is the #1 most used method of distributing coupons AND the reason e-coupons was originally added to sendsafe. " REWARDS PROGRAMS" like this REALLY WORK and bring paying customers back for more...

Job issuing is used to run a SendSafe job that sends out e-coupons to a selected (SQL) group of existing customers base. Buy Event Issuing is used to send out e-coupons to specific customers when they purchase specific items or types of items.

Buy Event E-Coupon Issuing

This is an exteemely powerful feature that can be used to generate return customer traffic.

Coupons are not generated for orders with a zero dollar amount. This rule prevents coupons from being issued on 100% discounted orders.

Buy Event issuing is configured by creating auto-coupon templates. An auto-coupon template is a coupon record with the AutoCoupon and Coupon Template check boxes checked. The E-Coupon WebAdmin page is used to create auto-coupon templates as well as individual e-coupons.

A single user unique E-Coupon is issued and emailed to the customer when a product is purchased which is listed in either the AutoCouponProductId or AutoCouponProductType fields of an auto-coupon template. The e-coupon will be issued to the customer that made the purchase once their credit card has been authorized. Coupons are bulk processed every 15 minutes so the average wait to recieve a coupon is 7.5 minutes. A single order can result in multiple e-coupons if several matching items are purchased. Additionally, a single item purchased can result in multiple e-coupons if the item is listed in more than one auto-coupon template.

Rules:

  1. Unless deplex its lineitems is setup, and the customer ordered more than one of a matching item then the system will issue a single coupon worth "One Coupon Unit Value" per Item ordered, instead of issuing multiple individual coupons. For example: If the autocoupon template had a TotalDollarValue of $10 and the customer ordered 5 matching items then coupon issued to the customer would have the autocoupon template value of TotalDollarValue increased to $10 x 5 = $50.00.
  2. If the RequiredDiscountPlan is set to a value other than null then the customer must be a member of that discount plan to recieve this auto-coupon with the exception of the reserved word ECREDITLINE which indicates special sales tax handling and/or simulated credit lines
  3. The Beginning date for the coupon is set to the date that the order was placed.
  4. The ending date for the coupon is set to the difference in days between the beginning and ending dates as set in the autocoupon template.
  5. The contents of the CodeDescriptor from the template is inserted into the codedescriptor field for each autocoupon that is created. Setting this field to {CID} will result in the user's customerId bein insterted into this field upon first use.
  6. Auto-Coupons will not be issued for items which have a zero dollars value.
  7. Auto-Coupons will not be issued on orders where the entire coupon and sale adjusted cost of the order is zero.
  8. Auto-Coupons will not be emailed if the IssuedTo field is set to "NOSEND@".
  9. Set IssuedBy = NULL to suppress admin emails being set to confirm generation of the coupon.

Job for Issuing E-Coupons

The SendSafe job scheduler has built in jobs for many different activities. One of the built in jobs is for issuing coupons. You can use the job scheduler to run a job once or to run the same job on a periodic basis.

The one time jobs are often used to issue single user unique E-Coupon to a group of customers. This group is specified by an SQL Select statement that you provide (so virtually any selection criteria is possible).

The periodic jobs are useful (for example) if you issue single user unique E-Coupon to customers on specific days of the month. One application might be setting up a job that uses an SQL Select statement that will send coupons to anyone that made a purchase in the last sixty days.

To create a job that issues coupons using jobs follow the steps below (see also jobqueue). An admin page for modifying the job queue does not exist at this time so these jobs must be entered into the database manually or via a 3rd party program.

  1. Add a job to the job queue (using SQL Query tool of your choice).
  2. Set the JobCode = 1
  3. Set the store = your store
  4. Set the scheduling = when you want the job to run (typically this is every XX day the month).
  5. Set enabled = 0 (set to 1 when you are doing setting up this job and want this job to be avaiable for execution).
  6. Set runnable = 1 (typically the backup robot will not be running this kind of job).
  7. Set Param1 = the SQL Selection logic that will produce a list of customer who will receive coupons.
  8. Set Param2 = the Coupon number (not indexkey) for the Coupon Database Record that will be a template for the coupons being issued.
  9. Set Param3 = Optionally set this field to the string "{FIXEDDATES}" which will cause the dates in the templates to be the same as the dates in the coupon. Optionally set this field to the string "{SIMRUN}" which will cause the job scheduler to run the job without creating or issuing coupons (check the audit file for a list of customerId's that would have received a coupon).
  10. Set NextRun = the date and time when you want the 1st run to occur.
  11. All other fields set to NULL

Param2 is a template for the coupon that will be created. All fields in the Template Coupon Database Record will be used DIRECTLY to create the new record except as listed below.

  1. The CouponNumber will be a newly generated number or a number based on special template codes (see below)
  2. The Coupon Template checkbox must be checked for template AND WILL BE SET TO 0 for the resulting coupons.
  3. The BeginDate will be set to the CURRENT date of issue UNLESS "{FIXEDDATES}" is in param3 THEN the actual date of the coupon will be used.
  4. The EndDate will be set to the difference in days between the beginning and ending dates as set in the coupon template UNLESS "{FIXEDDATES}" is in param3 THEN the actual date of the coupon will be used.
  5. The IssuedTo field will be set to the e-mail address of the customer that the coupon was issued to unless the tempplate is set to "NOSEND@".
  6. The contents of the CodeDescriptor  in the template is inserted into the codedescriptor field for each e-coupon that is created UNLESS "{ECREDITLINK}" is entered into the template. If {ECREDITLINK} is in the template THE CUSTOMERS CustomerId will be insteaded into the code descriptor to link this coupon to the customer for AEC and QBC type coupons..

The CouponNumber in the template can be used to specify how a coupon number is constructed. If the number does not contain any of the reserved keywords below THEN the coupon number will be randomly generated by the system immediately OR during coupon issuing.

If the coupon does contain any reserve keywords THEN the coupon number will be generated using the first 11 characters of the coupon number FOLLWED BY any data resulting from all the keywords.

Synatx example: [First 11 characters in the template couponnumber field] + <LASTNAME | USERID>
  1. reserved keyword = "LASTNAMEKEY" then the coupon number will contain a string which will be the LASTNAME of the customer with a prefix of the first 3 characters of their password. If the last name cannot be tokenized THEN the entire name is used.
  2. reserved keyword = "USERID" then the coupon number will contain a string which will be the USERID of the customer.

The job processes a list of customerid's. Param1 contains an SQL clause that selects a list of customers who will be e-mailed coupons. This SQL clause can be as simple as "select customerid from customers" or as complex as the example SQL below which will select all customers who have belonged to a club prior to last month and purchased a specific product type last month. If you are going to use long SQL clauses like the one below then it is recommended that you use stored procedures instead of inserting very long SQL clauses into param1. 

Select Distinct Customers.CustomerId From orders, OrderLineItem, Customers, Addresses, Items
where
OrderLineItem.TransactionId = Orders.TransactionId AND
Orders.CustomerId = Customers.CustomerId AND
Items.ItemCodeId = OrderLineItem.ItemCodeId AND
Addresses.AddressCodeId = Customers.AddressID AND
Items.ProductType = 'CLUBMEMBERSHIP' AND
Customers.DiscountPlan = 'ClubLevel1' AND
Orders.Date < CAST( CAST ( DATEPART(MONTH, DATEADD(month, -1, getdate() ) ) AS char ) + '/1/' + CAST ( DATEPART(YEAR, DATEADD(month, -1, getdate() ) ) AS char ) AS datetime) AND
Customers.CustomerId IN

    (Select Distinct Customers.CustomerId From orders, OrderLineItem, Customers, Items, Addresses
    where
    OrderLineItem.TransactionId = Orders.TransactionId AND
    Orders.CustomerId = Customers.CustomerId AND
    Addresses.AddressCodeId = Customers.AddressID AND
    tems.ItemCodeId = OrderLineItem.ItemCodeId AND
    Items.ProductType = 'BOOKS' AND
    Customers.DiscountPlan = 'ClubLevel1' AND
    Orders.Date between CAST( CAST( DATEPART(MONTH, DATEADD(month, -1, getdate() ) ) AS char ) + '/15/' + CAST( DATEPART(YEAR, DATEADD(month, -1, getdate() ) ) AS char ) AS datetime) AND
    CAST( CAST( DATEPART(MONTH, CURRENT_TIMESTAMP ) AS char ) + '/15/' + CAST( DATEPART(YEAR, CURRENT_TIMESTAMP ) AS char ) AS datetime) )

General E-Coupon Acceptance Configuration

E-Coupons must be enabled in the storefront admin for the e-coupon entry fields to appear on the shopping cart pages. In the storefront set "Coupons Enabled" = 1. The system configuration cookie "EnableCoupons" holds the state for the storefront configuration. After you enable coupons, you must reload the storefront. Coupons can also be enabled/disable on an individual order by the E-Coupon limiting flags. Since e-coupons are enabled/disabled on a session basis, you must shutdown your browser and reopen it after you enable coupons (to enable coupons for your session).

Storefront config (Admin page):

Web config (global.inc.asa):

The following entries in the robot configuration file for the storefront can be used to personalize or customize the text and appearance of the e-coupon, the help URL included in the e-coupon, and URL Links to e-store web site that appear in the e-coupon.

Things to Check when Coupons are not Working

The coupon entry fields will only be displayed when two conditions are met:

Coupon internals

Coupons are calculated in two steps.

Pre-Submission (step): The amount of the coupon is pre-calculated (estimated) and displayed in the shopping cart GUI. The coupons affect on sales tax is also estimated and displayed. The following functions and variables are used in the basketlister module:

Post-Submission (step): Inside the robot, once an order is submitted, the coupon is validated. If the coupon passes validation (date, uses left, and activiation status), the sales tax and final amount of the order are calulcated. This adjusted amount is then passed on for credit card approval. The validation process DOES NOT INCLUDE recalculation of the discount amount calculated in the cart GUI.

Details: