Coupon Validation and Limits
When a cashier enters a coupon code at the Point of Sale, AccuArk runs a series of validation checks before allowing the discount to be applied. This article explains every validation rule in order, how usage limits work, what happens with anonymous customers, and how the system prevents double-use across terminals.
Validation Rules
The system checks the following rules in sequence. If any rule fails, the coupon is rejected immediately and the cashier sees a specific error message explaining why. The rules are:
1. Code Exists and Is Active
The first check confirms that the entered code matches an existing coupon record in the database and that the coupon's status is Active. If the code does not exist, the cashier sees "Coupon code not found." If the coupon exists but has been deactivated, the message reads "This coupon is no longer active."
2. Date Range Validation
If the coupon has a start date, the system checks that the current date and time is on or after the start date. If the coupon has an end date, the system checks that the current date and time is on or before the end date. Failure messages include "This coupon is not yet valid (starts on [date])" or "This coupon has expired (ended on [date])."
3. Minimum Spend Requirement
If the coupon has a minimum spend value set, the system compares the current invoice subtotal against that threshold. The subtotal used for this comparison is calculated after any item-level pricing adjustments but before tax and before any other coupon discounts. If the subtotal is below the minimum, the cashier sees "Minimum spend of $[amount] required. Current subtotal is $[amount]."
4. Location Validation
If the coupon has location restrictions enabled, the system checks whether the current POS terminal's location is in the coupon's list of allowed locations. If the current location is not in the list, the cashier sees "This coupon is not valid at this location."
5. Total Usage Limit
If the coupon has a maximum total uses value set (max_total_uses > 0), the system checks the current redemption count against that limit. If the total number of redemptions has already reached or exceeded the maximum, the cashier sees "This coupon has reached its maximum number of uses."
6. Per-Customer Usage Limit
If the coupon has a per-customer usage limit set (max_uses_per_customer > 0), the system checks how many times the specific customer account attached to the current sale has already used this coupon. If that customer's usage count has reached the limit, the cashier sees "This customer has already used this coupon the maximum number of times."
Anonymous Customer Restrictions
Per-customer usage limits rely on identifying which customer is making the purchase. This creates an important restriction for walk-in customers:
- If a coupon has max_uses_per_customer > 0, the sale must have a customer account attached. The system needs a customer ID to look up that customer's previous usage of this coupon.
- If the current sale does not have a customer account (i.e., it is an anonymous walk-in transaction), and the coupon has per-customer limits, the coupon will be rejected with the message "This coupon requires a customer account. Please attach a customer to the sale before applying this coupon."
- Coupons that do not have per-customer limits (max_uses_per_customer = 0 or NULL) can be used by anyone, including anonymous walk-in customers, as long as all other validation rules pass.
This design prevents abuse of per-customer-limited coupons by ensuring the system can always identify and track who is using the coupon.
Atomic Usage Tracking
In a multi-terminal environment, it is possible for two cashiers to enter the same coupon code at nearly the same time. AccuArk prevents double-use through atomic database operations:
- When a coupon is successfully validated and the sale is completed, the system increments the coupon's usage counter using an atomic database update. This means the increment operation reads the current count and writes the new count in a single, indivisible operation.
- If two terminals attempt to redeem the last available use of a coupon simultaneously, only one will succeed. The other terminal's transaction will find that the usage count has already reached the maximum and will reject the coupon.
- This atomic approach eliminates race conditions without requiring explicit table locks, keeping POS performance fast even during high-traffic periods.
Validation Failure Messages
Here is a complete reference of every validation failure message a cashier may see:
| Validation Rule | Error Message |
|---|---|
| Code not found | "Coupon code not found." |
| Coupon inactive | "This coupon is no longer active." |
| Before start date | "This coupon is not yet valid (starts on [date])." |
| After end date | "This coupon has expired (ended on [date])." |
| Below minimum spend | "Minimum spend of $[amount] required. Current subtotal is $[amount]." |
| Wrong location | "This coupon is not valid at this location." |
| Total uses exceeded | "This coupon has reached its maximum number of uses." |
| Per-customer uses exceeded | "This customer has already used this coupon the maximum number of times." |
| No customer account (per-customer limit) | "This coupon requires a customer account. Please attach a customer to the sale before applying this coupon." |
All error messages are displayed in red on the coupon entry form so they are immediately visible to the cashier.
How Validation Order Matters
The validation rules are checked in the order listed above. This means the system stops at the first failure and reports that specific reason. For example, if a coupon is both expired and over its usage limit, the cashier will see the expiration message (rule 2) rather than the usage limit message (rule 5), because the date check happens first.
This sequential approach ensures that error messages are always relevant and actionable. The cashier does not need to guess which of multiple possible issues is blocking the coupon.
Tips
- Attach customer accounts early — If your store frequently uses per-customer-limited coupons, train cashiers to attach the customer account to the sale before attempting to apply a coupon. This avoids the frustration of entering a code only to be told a customer account is required.
- Check expiration before distributing — Before handing out coupons to customers, verify that the coupon's date range covers the intended promotional period.
- Monitor near-limit coupons — Use the coupon management list to identify coupons approaching their total usage limit. Consider increasing the limit or creating a replacement coupon if demand is higher than expected.