Deprecated
This endpoint represents the deprecated version of the API responsible for qualification, and we do not recommend using it. The new Qualifications API introduces additional features and improvements while maintaining backward compatibility. Developers are encouraged to migrate to the latest version to take advantage of the latest enhancements and bug fixes. No updates will be provided to the deprecated endpoint.
Display vouchers qualified to the given customer and context (e.g., order, loyalty reward). Checks up to 50 standalone vouchers.
Prevailing assumption
You data is synced with Voucherify.
How does this endpoint work?
A property's value that does not meet a validation rule requirement will disqualify that particular voucher and it will not be listed in the results.
As a sample use case, you can imagine a requirement of displaying coupons available for the customer below the shopping cart. The customer can choose and apply the proposed voucher.
What's excluded?
The verification logic won't run against coupons from bulk unique code campaigns. For campaigns with multiple unique codes, you should run a dedicated function for searching and identifying qualified campaigns.
Customizing the response
Query parameters let you sort and filter the returned vouchers
Customize your response:
- If you only care about verifying a customer, use
audienceRulesOnly
set totrue
.- If you want to limit the number of vouchers to be returned from the entire pool of eligible vouchers, set a
limit
. This will return vouchers sorted by-created_at
, by default beginning with the most recent vouchers listed at the top.- If you have a preference on the sorting order of the returned vouchers, you can use
order
to customize your response.
Sending the request body payload
Customer
You have the option of sending customer data via the dedicated customer
object in the request body or a nested customer
object within the order
object.
Available options:
-
You can either pass a customer
id
(Voucherify system generated), -
a
source_id
(your own unique internal customer identifier e.g., email, database ID, CRM id), -
a combination of the remaining parameters in the customer object,
-
a combination of customer
id
and remaining parameters excludingsource_id
, or -
a combination of
source_id
and remaining parameters excludingid
Note:
For the latter two options, if you pass the source_id
or the id
with the other parameters, the logic will run independently for parameters explicitly passed in the request body versus those not explicitly passed in the request body. For parameters not explicitly listed in the payload, the verification will be against the data stored for that customer in the system. On the other hand, for any parameter values explicitly passed in the payload, the logic will ignore those stored in the system and will use the new values provided in the qualification request body.
The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard. Read more.
Order
Available options:
-
You can either pass an order
id
(Voucherify system generated), -
a
source_id
(your own unique internal order identifier), -
a combination of the remaining parameters in the order object,
-
a combination of order
id
and remaining parameters excludingsource_id
, or -
a combination of
source_id
and remaining parameters excludingid
Note:
For the latter two options, if you pass the source_id
or the id
with the other parameters, the logic will run independently for parameters explicitly passed in the request body versus those not explicitly passed in the request body. For parameters not explicitly listed in the payload, the verification will be against the data stored for that order in the system. On the other hand, for any parameter values explicitly passed in the payload, the logic will ignore those stored in the system and will use the new values provided in the qualification request body.
The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard. Read more.
Guidelines:
To validate against vouchers with total order amount
requirements, make sure to include the total order amount
in the order object or alternatively the amount
for every order item (the application will then add each amount to get the total and perform the qualification checks). If the total order amount
is provided along with the individual items' amounts, the total order amount
will take precedence.
Case | Order-Level Parameter Included | Item-Level Parameter Included | Precedence | Calculation Result | Parameter included in payload accounts for checks against requirements in these validation rules |
---|---|---|---|---|---|
1 | amount | amount | Order-level | Uses order-level amount | - Total order amount |
2 | amount | Item-level | Sums each item-level amount | - Total order amount - subtotal of matched items | |
3 | price quantity | Item-level | Multiplies each item's (price x quantity ) to get item amount and then adds each item's amount to get total order amount | - Total order amount - Subtotal of matched items - Unit price of any matching order line - Price of each item/Price of any item | |
4 | amount price quantity | Item-level amount | Uses item-level amount for total order amount calculation, ignores (price x quantity ) calculation | - Total order amount (uses item amount if provided or price x quantity for items without amount property; amount takes precedence in case all 3 properties are provided for an item)- Subtotal of matched items (uses item amount , takes precedence if all 3 properties are provided)- Unit price of any matching order line - Price of each item/Price of any item | |
5 | amount | amount price quantity | Order-level | Uses order-level amount for total order amount | - Total order amount (uses order-level amount ). - Subtotal of matched items (see case 4 for details). - Unit price of any matching order line - Price of each item/Price of any item |