Overview
Vouchers are discount codes that customers can apply during checkout to redeem associated offers. Each voucher is linked to a specific offer and controls how many times it can be used through various usage patterns.Voucher Usage Types
Vouchers support three different usage patterns:Single Use
The voucher can only be used once total, across all customers. Once redeemed, it becomes invalid for everyone.Multiple Use
The voucher can be used multiple times by any customer until it reaches itsmax_usage_limit.
Once Per Customer
Each customer can use the voucher once. The voucher remains valid for other customers until it reaches itsmax_usage_limit.
Voucher Validation
When a voucher is applied, the system validates:-
Usage Limits:
- For
singleuse: Voucher must not have been used before (num_of_usagemust be 0) - For
multipleuse:num_of_usagemust be less thanmax_usage_limit - For
once_per_customeruse: Customer must not have redeemed this voucher before
- For
-
Validity Period: Current time must be between
valid_fromandvalid_to - Associated Offer: The linked offer must be active and not expired
- Order Value: If the offer has a minimum order value condition, the cart subtotal must meet it
- Offer Conditions: All conditions of the associated offer must be satisfied
Apply Voucher to Cart
Applies a voucher code to the customer’s shopping cart. The voucher discount will be calculated based on the associated offer’s discount type and value.Request Body
The voucher code to apply (case-insensitive, will be converted to uppercase)
Request Example
Response
Success message confirming the voucher was applied
Success Response Example
Error Responses
Error message explaining why the voucher could not be applied
Validation error for missing voucher code
Missing Voucher Code (400)
Invalid Voucher (400)
Usage Limit Reached (400)
Expired Voucher (400)
Minimum Order Value Not Met (400)
Customer Already Used Voucher (400)
Foronce_per_customer vouchers:
Offer Conditions Not Met (400)
Remove Voucher from Cart
Removes the currently applied voucher from the customer’s shopping cart.Response
Success message confirming the voucher was removed
Error message if no voucher is currently applied
Success Response Example
Error Response Example (400)
Voucher Model Structure
Vouchers are returned as part of the Offers endpoint response in thevoucher_set array.
Unique identifier for the voucher
Display name of the voucher
Detailed description of what the voucher offers
Unique voucher code that customers use to redeem the offer (always uppercase)
Usage pattern:
single, multiple, or once_per_customerMaximum number of times this voucher can be used in total
Current number of times this voucher has been used
Start date and time when the voucher becomes valid
End date and time when the voucher expires
Whether the voucher is currently active
Redemption Flow
- Customer enters voucher code at checkout
- System validates voucher:
- Checks if voucher exists and is active
- Verifies usage limits based on
usage_type - Confirms voucher is within validity period
- Validates associated offer conditions
- Discount is applied to cart if all validations pass
- Usage count is updated when order is completed:
num_of_usageis incremented- Redemption is recorded in
RedeemedVouchertable with customer and timestamp
- Offer discount tracking is updated:
total_discount_offeredon the offer is increased by the discount amount- Customer is added to
claimed_bylist on the offer
Best Practices
For Single-Use Vouchers
- Set
usage_typetosingle - Set
max_usage_limitto1 - Use for exclusive or high-value promotions
For Multi-Use Vouchers
- Set
usage_typetomultiple - Set appropriate
max_usage_limitbased on campaign budget - Monitor
num_of_usageto track campaign performance
For Once-Per-Customer Vouchers
- Set
usage_typetoonce_per_customer - Set
max_usage_limitbased on expected customer reach - Ideal for welcome offers and customer acquisition campaigns
- Requires customer authentication to track usage