[deprecated] Validation Rules

Important note

This is deprecated documentation that refers to v20210518 and former Voucherify versions. Please follow this guide for the recent documentation.

In this section:

  1. Description of available validation rules
  2. How to build a rule?
  3. Build rules in Validation Rules Dashboard section
  4. Build rules in the Campaign Manager
  5. Validation rules with Metadata-Schema Validation
  6. Validation rules with time and date
  7. Validation rules with product metadata


The aim of creating validation rules is to model the desired incentive redemption circumstances. Rules are built with attributes and operators divided into 6 categories:

Validation Rules Overview


By using customer segments, you can choose a target or exclude a particular customer segment from clients allowed for redemption. While adding validation rules based on segments, you can choose to include/exclude one of the existing segments or create a new segment from scratch.

Audience validation rules

You can also use custom attributes defined previously in Metadata Schema and create unique validation rules based on their values. 

For example, imagine you have a gym and your customers have different memberships. Despite the fact that Voucherify doesn't offer such customer attributes by default, you can use metadata to put in into customer profiles. By adding property membership to Metadata Schema you can target a specific group of members. 

Go here to see how to use metadata in customer segmentation in practice.

audience specific validation rules

There aren't any limits on the type or number of custom attributes. You can add as many customer attributes as you'd like. 

 Validation attribute Description Example
Customer segment

The first property enables you to limit redemptions to specific customer segments. It can be useful if you want to take into account only new customers, or regular clients or any other segments you come up with. 
Redemption is available if a customer enters a segment "Regular Customers" and redemption is not available for customers from the "New customers" segment.
Customer metadata satisfy You don't have to create a customer segment based on metadata as Voucherify can automatically target customers who meet metadata criteria. For instance, you can state that only customers with revenue above 2000$ are eligible for a discount without creating a separate customer segment beforehand.

Order structure

With the following rules, you can create product-specific promotions based on a cart structure and quantity/price of items in the cart.

Order structure validation rules

Please note that you have to import your product catalog to use the rules listed below. Learn more here.
Validation attribute Description Example
Contains product 

With this attribute, a customer gets a discount if the order contains a product:    
  • in a particular amount – Order items quantity
  • at a particular price – Order item price
The last option Discount applicable to this order item states that the discount is applicable to the added item ( products or SKUs). If you want to discount the product, mark the checkbox.
A customer can redeem the code if the order contains at least 3 products X in the cart.
Does not contain product You can specify the products excluded from the promotion. A customer can get a discount only if the cart does not contain product X.
Contains SKU / Does not contain SKU SKU (Stock Keeping Unit) is an attribute that differentiates product variants. Used in a validation rule, it makes a coupon active only if the particular variant is in a cart (and optionally set the required amount in the cart). Choose SKU/SKUs which have to be in the cart, and then mark a checkbox "Discount is applicable to this SKU" to make a discount valid only to the added items.  A customer can use a gift card only for black and silver iPhones and cannot use it to buy a white variant (SKU) of the product.
Product and order metadata satisfy Rules based on custom attributes assigned to your products and orders, e.g., series. You can add as many metadata attributes as you wish.
A discount is applicable only to products which series begins with AT54.
Any order item product metadata satisfy These rules allow you to make an order eligible for a discount if any item in your customer's cart meets the metadata set for the given campaign. Customers will get a discount if at least one product in his/her cart meets metadata. 
Each order item product metadata satisfy These rules allow you to make an order eligible for a discount if all items in your customer's cart meet the metadata set for the given campaign. For example, your customer has to purchase only products in a certain color for his/her order to be eligible for a discount.

Order volume

Introduce cart’s price-related constraints to up-sell and boost sales.

Order volume validation rules

Validation attribute Description Example
Total amount
You can define a maximum/minimum value of a customer's cart that enables them to use the code. Discount applies only if the total amount of the order is more than $50.
Items quantity 
You can select a required quantity (min/max) of products that need to be in a customer's cart.
Discount applies only if a customer bought at least 5 products at once.
Price of each item
You can set a minimum/maximum price for each product from a customer's cart.

Discount applies only if the price of every item in a cart is more than $50.
Price of any item 
This rule defines a minimum/maximum price required for at least one product from a customer's cart.
If a customer's cart contains at least one product for more than $100, the code can be redeemed.

Budget constraints

Control promotion budget by setting up safety limits that automatically deactivate your promotion.

Budget constraints

Validation attribute Description Example
* Total discounted amount
It defines the overall value of the discount that your customers can get by redeeming codes from a particular campaign.
The total value of applied discounts from campaign X has to be less than $10 000.
* Total orders value
You can select the maximum value of all orders made within the campaign. When this limit is reached, customers cannot redeem more codes.

The value of all orders made within the Y campaign cannot be more than $20 000. 
* Total number of redemptions
It's a total number of redemptions allowed per entire campaign. 
Customers can redeem codes from a campaign 3 000 times. 
* Total redeemed gift amount 
It defines the total value of redeemed gift cards amongst the whole  campaign 
Customers can spend $10 000 of the balance from a gift card campaign.
Redemptions per customer per code
It defines the total number of redemptions counted per customer per code. Customer can make only one redemption per each unique code in the campaign
* Redemptions per customer in a campaign It defines the total number of redemptions counted per customer per campaign.
Customer can make only 1 redemption by using codes from the campaign. It means that once a customer redeems a code, he/she can't redeem another one from this campaign.
Redemptions per customer per code per day It defines the daily limit of redemptions that a particular customer can make using the same unique code.
Customer can redeem their unique code only once per day.

* This is a campaign-related rule, it isn't available for standalone codes. Standalone code is a single code. The campaign-related rules refer to a bulk codes option with a batch of unique codes grouped in a campaign.


Control redemption with rules based on custom fields and access policy. 

Advanced validation rules

Validation attribute Description Example
Redemption metadata satisfy
Read more here.
The code redemption is only available for orders made before 4 pm. 
Redeeming user 
With this  rule,  you can manage your team and define which team members or affiliates can/cannot invoke a coupon redemption. User "Denver_department" can invoke redemptions and the user "Central_department" cannot redeem codes.
Redeeming API key This attribute allows you to limit redemption to particular API keys.  For instance, you can limit redemptions to 3 per specific users with the same API key.
Only for customers who are holders of the card 
With this attribute, you can improve fraud detection and reduce coupon misuses. By using this rule, you ensure that a voucher is redeemed by the same person that it was published to (sent). 
When you save the campaign and share the codes, a customer will be able to utilize a coupon only if its publication is assigned to his/her id.  

Discounted Products

By using the Discounted Products, you can:

  • Assign discounts to specific order line items when other validation criteria are met.
  • Exclude specific products from the discounts applied by other validation criteria.
Please note that rules created in the Discounted Products will work only when other Validation Rules are set.

Validation attribute Description Example
Discount the following Products and SKUs
Products and SKUs noted in the following list will have the discount applied.
Discount is applied to Product X when Product Y and Product Z are in the customer's cart (defined in Order Structure).

Exclude the following Products and SKUs

The Products and SKUs defined on the following list will be excluded from the discounts. 
Discount is applied to all products with the "category" metadata set to "electronics" excluding Product X.

You can define custom error messages per the Validation Rule which are going to be returned via an API when code redemption fails due to the request not meeting validation rule criteria. Additionally, you can specify a fallback error message that will be used when there is no error message defined for the particular rule.

How to build a rule?

There are two ways you can create validation rules in Voucherify Dashboard:

  1. You can go to the Validation Rules section in the Dashboard, create and save a set of rules, and use them later on while creating a campaign.
  2. You can create validation rules from scratch while creating a campaign in the Campaign Manager.

After you  save the rules they will be automatically added to the Validation Rules section ready to use in your future campaigns.

Adding validation rules via the Dashboard

Go to the 'Validation Rules' section in the Dashboard and choose the Plus to create new rules. Add a name for your new rule/set of rules 

Building validation rules

For example, you can choose a customer segment who can/cannot redeem the codes. To build a rule, you need to add an operator is/is not in the first input and choose the desired customer segment from the list of segments in the 2nd input.

Adding a new rule

All active rules that you have confirmed are visible in the grey background below the category.

Already applied validation rules

You can save each rule or rules set and use them later while creating campaigns in the Campaign Manager.

Adding validation rules in the Campaign Manager

Firstly you need to run the Campaign Manager and choose a campaign type you'd like to create. Go through the first two stages of a campaign creation process.

Validation Rules

In the 3rd step, you can add validation rules and define what criteria customers and their orders have to match to make a valid redemption.

Validation rules with Metadata-Schema Validation

This guide assumes you are already familiar with the Metadata-Schema Validation. If you need help with that, follow this link.

Voucherify Metadata-Schema Validation enables you to create the following metadata attributes:

  • text
  • flag
  • number
  • date
  • image URL
  • date-time

These custom properties can relate to all Voucherify object types:

  • campaigns,
  • vouchers,
  • products,
  • SKUs,
  • redemptions,
  • customers,
  • publications,
  • orders.

You can use them to add specific campaign limits or customer segment rules. Different types of attributes allow you to create rules based on specific numbers, dates, and time frames. Let's explore some examples.

Redemption metadata with date and time

Metadata attributes assigned to redemption objects can be used to create validation rules during the 3rd stage of the Campaign Manager.

Firstly, you need to add metadata properties to the project's Metadata Schema.

Metadata redemption time

In the picture, you can see one metadata attribute assigned to redemption objects: 

  • booking_time type 'date-time' 
Let's use it to add validation rules in a new coupon campaign. The rules engine in the Campaign Manager enables you to set required values of redemption metadata to particular dates, days of the week, timeframes, or numbers.

Advanced time metadata

In case of attributes typed as 'date-time' or 'date' you can also restrict property value to a particular day/days of the week.  

We recreated a similar campaign here.

Validation rules with products/SKUs metadata 

Each custom attribute that you add to product objects using API or Metadata Schema, can be used to create validation rules.

You don't have to import your inventory to use product-specific rules in your campaigns. That means there is no need to store products catalog in Voucherify upfront and up-to-date. If you use API to invoke codes' redemptions, then you can add products with metadata while invoking redemption (to the redemption request). You can read more in this guide.

To use Metadata-Schema Validation created for products or SKUs, you need to choose the validation rule from Order structure > Product metadata satisfy. Similarly to the previous case, assigned properties will be listed automatically after choosing the rule. 

Product metadata

You can use assigned properties to build product-specific rules

Metadata specific rules

When you choose a required value for a property, confirm with Add. The campaign redemptions will be restricted by added limits and redemption request needs to be equipped with product metadata attributes with assigned values. Otherwise, the system will reject the redemption request.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us