Redeem Voucher
❗️ Deprecated
This endpoint represents the deprecated version of the API responsible for voucher redemption, and we do not recommend using it. The new Stackable Discounts API introduces additional features and improvements while maintaining backward compatibility, including applying a combination of coupon codes and promotion tiers. 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.
To redeem a voucher, you create a redemption object. It increments the redemption counter and updates the history of the voucher.
How discounts and order amounts are calculated in the API response?
In the table below, you can see the logic the API follows to calculate discounts and amounts:
| Field | Calculation | Description |
|---|---|---|
| amount | N/A | This field shows the order amount before applying any discount |
| total_amount | total_amount = amount - total_discount_amount | This field shows the order amount after applying all the discounts |
| discount_amount | discount_amount = previous_discount_amount + applied_discount_amount | This field sums up all order-level discounts applied to a patricular order |
| items_discount_amount | sum(items, i => i.discount_amount) | This field sums up all product-specific discounts applied to this order |
| total_discount_amount | total_discount_amount = discount_amount + items_discount_amount | This field sums up all order-level and all product-specific discounts applied to this order |
| applied_discount_amount | N/A | This field shows order-level discount applied in a particular request |
| items_applied_discount_amount | sum(items, i => i.applied_discount_amount) | This field sums up all product-specific discounts applied in a particular request |
| total_applied_discount_amount | total_applied_discount_amount = applied_discount_amount + items_applied_discount_amount | This field sums up all order-level and all product-specific discounts applied in a particular request |
Query parameters
A tracking identifier of a user that redeemed a voucher. Identifier generated during voucher validation based on your internal id (e.g., email, database ID). This is a hashed customer source ID. If you also pass a customer ID, the tracking ID must be the ID of a source of the customer object. Otherwise, if you do not pass a customer ID, the tracking you provide must either be a token, like the ones returned by voucher validation, or a string identifying customer, with the options described below. Although not all information is required, the extra info helps prevent fraud.
Request body
Example request
{
"session": {
"key": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts"
},
"customer": {
"id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv"
},
"order": {
"created_at": "2021-12-22T10:13:06.487Z",
"referrer_id": "cust_nM4jqPiaXUvQdVSA6vTRUnix"
},
"options": {
"expand": [
"category"
]
}
}Response
Returns a redemption object if the redeem operation succeeded.
Example response
{
"id": "r_0bc92f81a6801f9bca",
"date": "2022-10-03T12:24:58.008Z",
"customer_id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64",
"tracking_id": "track_fxEMFiLowFHg==",
"order": {
"id": "ord_OLWs41pBk7VFn6ZTyX9U6keh",
"created_at": "2022-10-06T11:40:48.705Z",
"updated_at": "2022-10-06T11:47:20.760Z",
"items": [
{
"product_id": "prod_5h0wc453_1",
"sku_id": "sku_prod_5h0wc453_1_1",
"product": {
"id": "prod_5h0wc453_1",
"source_id": "illy-arabica",
"name": "Brewing System"
},
"sku": {
"id": "sku_prod_5h0wc453_1_1",
"source_id": "illy-arabica-250g"
}
}
],
"customer": {
"id": "cust_7iUa6ICKyU6gH40dBU25kQU1"
},
"referrer": {
"id": "cust_7iUa6ICKyU6gH40dBU25kQU1"
},
"customer_id": "cust_7iUa6ICKyU6gH40dBU25kQU1",
"referrer_id": "cust_nM4jqPiaXUvQdVSA6vTRUnix",
"redemptions": {
"redemption_ID": {
"date": "2022-09-02T17:06:56.649Z"
}
}
},
"channel": {
"channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH"
},
"customer": {
"id": "cust_eWgXlBBiY6THFRJwX45Iakv4"
},
"voucher": {
"id": "v_mkZN9v7vjYUadXnHrMza8W5c34fE5KiV",
"code": "WVPblOYX",
"campaign": "Gift Card Campaign",
"campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV",
"category_id": "cat_0bb343dee3cdb5ec0c",
"gift": {
"amount": 10000,
"balance": 500
},
"loyalty_card": {
"points": 7000,
"balance": 6970,
"next_expiration_date": "2023-05-30"
},
"start_date": "2021-12-01T00:00:00.000Z",
"expiration_date": "2021-12-31T00:00:00.000Z",
"validity_timeframe": {
"duration": "PT1H",
"interval": "P2D"
},
"validity_hours": {
"daily": [
{
"start_time": "12:00",
"expiration_time": "14:00"
}
]
},
"assets": {
"qr": {
"id": "U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK+t4pp7U7oFzjGJzj9q/bmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg+BaZk5QwXMf8k/OzSlOEVybpwSq+AiqPoNtjeuqtIgkDyvT6Q==",
"url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK%2Bt4pp7U7oFzjGJzj9q%2FbmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg%2BBaZk5QwXMf8k%2FOzSlOEVybpwSq%2BAiqPoNtjeuqtIgkDyvT6Q%3D%3D"
},
"barcode": {
"id": "U2FsdGVkX19eJhGfWwUrH9+tulBkON+AnMktic+N6CVWzZ9+fHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ+kJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6/pFs61apEn9SJx32ttCF6d3oxKISQQ==",
"url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19eJhGfWwUrH9%2BtulBkON%2BAnMktic%2BN6CVWzZ9%2BfHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ%2BkJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6%2FpFs61apEn9SJx32ttCF6d3oxKISQQ%3D%3D"
}
},
"created_at": "2021-12-22T10:13:06.487Z",
"updated_at": "2021-12-22T10:14:45.316Z",
"holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4",
"referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv",
"publish": {
"url": "/v1/vouchers/WVPblOYX/publications?page=1&limit=10"
},
"redemption": {
"redeemed_quantity": 1,
"redeemed_points": 100000,
"url": "/v1/vouchers/WVPblOYX/redemptions?page=1&limit=10"
},
"categories": [
{
"created_at": "2022-07-14T10:45:13.156Z",
"updated_at": "2022-08-16T10:52:08.094Z"
}
],
"validation_rules_assignments": {
"data": [
{
"id": "asgm_LnY1g7UNFA9KyDrD",
"rule_id": "val_3gPNA6SnH4ae",
"related_object_id": "camp_CZOnEGiZfwIKWmSjhIoIT7Ol",
"related_object_type": "campaign",
"object": "validation_rules_assignment",
"validation_status": "PARTIALLY_VALID",
"validation_omitted_rules": [
"1"
]
}
]
}
}
}