curl --request POST \
--url https://{cluster}.voucherify.io/client/v1/validations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Client-Application-Id: <api-key>' \
--header 'X-Client-Token: <api-key>' \
--header 'origin: <origin>' \
--data '
{
"customer": {
"source_id": "sample_customer",
"metadata": {
"key": "value"
}
},
"options": {
"expand": [
"order",
"redeemable",
"category"
]
},
"redeemables": [
{
"object": "voucher",
"id": "voucher-code"
}
],
"session": {
"type": "LOCK"
},
"order": {
"amount": 55000,
"status": "PAID",
"items": [
{
"quantity": 2,
"price": 20000,
"source_id": "sample product1",
"related_object": "product",
"product": {
"metadata": {
"key": "value"
}
}
},
{
"quantity": 1,
"price": 15000,
"source_id": "sample product2",
"related_object": "product",
"product": {
"metadata": {
"key": "value"
}
}
}
],
"metadata": {
"key": "value"
}
}
}
'{
"valid": true,
"redeemables": [
{
"status": "APPLICABLE",
"id": "<string>",
"object": "voucher",
"result": {
"discount": {
"type": "AMOUNT",
"amount_off": 123,
"amount_off_formula": "<string>",
"aggregated_amount_limit": 123,
"effect": "APPLY_TO_ORDER",
"is_dynamic": true
},
"bundle": {
"quantity": 50,
"limit": 50,
"identified": [
{
"id": "<string>",
"object": "product",
"item_index": 1,
"item_quantity": 123
}
],
"missing": [
{
"id": "<string>",
"object": "product",
"item_quantity": 123
}
]
}
},
"order": {
"id": "<string>",
"source_id": "<string>",
"status": "CREATED",
"amount": 123,
"initial_amount": 123,
"discount_amount": 123,
"items_discount_amount": 123,
"total_discount_amount": 123,
"total_amount": 123,
"applied_discount_amount": 123,
"items_applied_discount_amount": 123,
"total_applied_discount_amount": 123,
"metadata": {},
"object": "order",
"created_at": "2021-12-22T10:13:06.487Z",
"updated_at": "2021-12-22T10:14:45.316Z",
"customer_id": "cust_7iUa6ICKyU6gH40dBU25kQU1",
"referrer_id": "cust_nM4jqPiaXUvQdVSA6vTRUnix",
"customer": {
"id": "<string>",
"object": "customer"
},
"referrer": {
"id": "<string>",
"object": "customer"
},
"redemptions": {},
"items": [
{
"object": "order_item",
"id": "<string>",
"sku_id": "<string>",
"product_id": "<string>",
"related_object": "product",
"source_id": "<string>",
"quantity": 123,
"discount_quantity": 123,
"initial_quantity": 123,
"amount": 123,
"discount_amount": 123,
"applied_discount_amount": 123,
"applied_discount_quantity": 123,
"applied_quantity": 123,
"applied_quantity_amount": 123,
"initial_amount": 123,
"price": 123,
"subtotal_amount": 123,
"product": {
"id": "<string>",
"source_id": "<string>",
"override": true,
"name": "<string>",
"metadata": {},
"price": 123
},
"sku": {
"id": "<string>",
"source_id": "<string>",
"override": true,
"sku": "<string>",
"price": 123,
"metadata": {}
},
"metadata": {}
}
]
},
"applicable_to": {
"data": [
{
"object": "product",
"id": "<string>",
"effect": "APPLY_TO_EVERY",
"source_id": "<string>",
"product_id": "<string>",
"product_source_id": "<string>",
"price": 123,
"price_formula": 123,
"quantity_limit": 123,
"aggregated_quantity_limit": 123,
"amount_limit": 123,
"aggregated_amount_limit": 123,
"order_item_indices": [
123
],
"order_item_units": [
{
"index": 1,
"units": [
123
],
"units_limit_exceeded": true
}
],
"repeat": 123,
"skip_initially": 123,
"target": "ITEM"
}
],
"total": 1,
"object": "list",
"data_ref": "data"
},
"inapplicable_to": {
"data": [
{
"object": "product",
"id": "<string>",
"effect": "APPLY_TO_EVERY",
"source_id": "<string>",
"product_id": "<string>",
"product_source_id": "<string>",
"price": 123,
"price_formula": 123,
"quantity_limit": 123,
"aggregated_quantity_limit": 123,
"amount_limit": 123,
"aggregated_amount_limit": 123,
"order_item_indices": [
123
],
"order_item_units": [
{
"index": 1,
"units": [
123
],
"units_limit_exceeded": true
}
],
"repeat": 123,
"skip_initially": 123,
"target": "ITEM"
}
],
"total": 1,
"object": "list",
"data_ref": "data"
},
"metadata": {},
"categories": [
{
"id": "<string>",
"name": "<string>",
"hierarchy": 1,
"object": "category",
"created_at": "2022-07-14T10:45:13.156Z",
"updated_at": "2022-08-16T10:52:08.094Z",
"stacking_rules_type": "JOINT"
}
],
"campaign_name": "<string>",
"campaign_id": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3",
"name": "<string>"
}
],
"stacking_rules": {
"redeemables_limit": 30,
"applicable_redeemables_limit": 5,
"applicable_redeemables_per_category_limit": 1,
"applicable_redeemables_category_limits": {},
"applicable_exclusive_redeemables_limit": 1,
"exclusive_categories": [
"<string>"
],
"joint_categories": [
"<string>"
],
"redeemables_application_mode": "ALL",
"redeemables_sorting_rule": "REQUESTED_ORDER",
"redeemables_products_application_mode": "STACK",
"redeemables_no_effect_rule": "REDEEM_ANYWAY",
"no_effect_skip_categories": [
"<string>"
],
"no_effect_redeem_anyway_categories": [
"<string>"
],
"redeemables_rollback_order_mode": "WITH_ORDER",
"applicable_exclusive_redeemables_per_category_limit": 1
},
"id": "valid_101740aa2869354c6d",
"skipped_redeemables": [
{
"status": "SKIPPED",
"id": "<string>",
"object": "voucher",
"result": {
"details": {
"key": "applicable_redeemables_limit_exceeded",
"message": "Applicable redeemables limit exceeded"
}
},
"metadata": {},
"categories": [
{
"id": "<string>",
"name": "<string>",
"hierarchy": 1,
"object": "category",
"created_at": "2022-07-14T10:45:13.156Z",
"updated_at": "2022-08-16T10:52:08.094Z",
"stacking_rules_type": "JOINT"
}
],
"campaign_name": "<string>",
"campaign_id": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3",
"name": "<string>"
}
],
"inapplicable_redeemables": [
{
"status": "INAPPLICABLE",
"id": "<string>",
"object": "voucher",
"result": {
"error": {
"code": 123,
"message": "<string>",
"key": "<string>",
"details": "<string>",
"request_id": "v-0a885062c80375740f",
"resource_id": "rf_0c5d710a87c8a31f86",
"resource_type": "voucher",
"error": {
"message": "<string>"
}
},
"details": {
"message": "<string>",
"key": "<string>"
},
"bundle": {
"quantity": 50,
"limit": 50,
"identified": [
{
"id": "<string>",
"object": "product",
"item_index": 1,
"item_quantity": 123
}
],
"missing": [
{
"id": "<string>",
"object": "product",
"item_quantity": 123
}
]
}
},
"metadata": {},
"categories": [
{
"id": "<string>",
"name": "<string>",
"hierarchy": 1,
"object": "category",
"created_at": "2022-07-14T10:45:13.156Z",
"updated_at": "2022-08-16T10:52:08.094Z",
"stacking_rules_type": "JOINT"
}
],
"campaign_name": "<string>",
"campaign_id": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3",
"name": "<string>"
}
],
"order": {
"id": "<string>",
"source_id": "<string>",
"status": "CREATED",
"amount": 123,
"initial_amount": 123,
"discount_amount": 123,
"items_discount_amount": 123,
"total_discount_amount": 123,
"total_amount": 123,
"applied_discount_amount": 123,
"items_applied_discount_amount": 123,
"total_applied_discount_amount": 123,
"metadata": {},
"object": "order",
"created_at": "2021-12-22T10:13:06.487Z",
"updated_at": "2021-12-22T10:14:45.316Z",
"customer_id": "cust_7iUa6ICKyU6gH40dBU25kQU1",
"referrer_id": "cust_nM4jqPiaXUvQdVSA6vTRUnix",
"customer": {
"id": "<string>",
"object": "customer"
},
"referrer": {
"id": "<string>",
"object": "customer"
},
"redemptions": {},
"items": [
{
"object": "order_item",
"id": "<string>",
"sku_id": "<string>",
"product_id": "<string>",
"related_object": "product",
"source_id": "<string>",
"quantity": 123,
"discount_quantity": 123,
"initial_quantity": 123,
"amount": 123,
"discount_amount": 123,
"applied_discount_amount": 123,
"applied_discount_quantity": 123,
"applied_quantity": 123,
"applied_quantity_amount": 123,
"initial_amount": 123,
"price": 123,
"subtotal_amount": 123,
"product": {
"id": "<string>",
"source_id": "<string>",
"override": true,
"name": "<string>",
"metadata": {},
"price": 123
},
"sku": {
"id": "<string>",
"source_id": "<string>",
"override": true,
"sku": "<string>",
"price": 123,
"metadata": {}
},
"metadata": {},
"application_details": [
{
"source_index": 1,
"source_applied_quantity": -2,
"source_applied_quantity_amount": -1,
"target_index": 123,
"target_applied_quantity": 123,
"target_applied_quantity_amount": 123,
"target_applied_discount_amount": 123
}
]
}
]
},
"tracking_id": "track_VAVo1/z+G2GI2LPw==",
"session": {
"key": "<string>",
"type": "LOCK",
"ttl": 123,
"ttl_unit": "DAYS"
}
}Verify redeemables provided in the request. This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications.
curl --request POST \
--url https://{cluster}.voucherify.io/client/v1/validations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Client-Application-Id: <api-key>' \
--header 'X-Client-Token: <api-key>' \
--header 'origin: <origin>' \
--data '
{
"customer": {
"source_id": "sample_customer",
"metadata": {
"key": "value"
}
},
"options": {
"expand": [
"order",
"redeemable",
"category"
]
},
"redeemables": [
{
"object": "voucher",
"id": "voucher-code"
}
],
"session": {
"type": "LOCK"
},
"order": {
"amount": 55000,
"status": "PAID",
"items": [
{
"quantity": 2,
"price": 20000,
"source_id": "sample product1",
"related_object": "product",
"product": {
"metadata": {
"key": "value"
}
}
},
{
"quantity": 1,
"price": 15000,
"source_id": "sample product2",
"related_object": "product",
"product": {
"metadata": {
"key": "value"
}
}
}
],
"metadata": {
"key": "value"
}
}
}
'{
"valid": true,
"redeemables": [
{
"status": "APPLICABLE",
"id": "<string>",
"object": "voucher",
"result": {
"discount": {
"type": "AMOUNT",
"amount_off": 123,
"amount_off_formula": "<string>",
"aggregated_amount_limit": 123,
"effect": "APPLY_TO_ORDER",
"is_dynamic": true
},
"bundle": {
"quantity": 50,
"limit": 50,
"identified": [
{
"id": "<string>",
"object": "product",
"item_index": 1,
"item_quantity": 123
}
],
"missing": [
{
"id": "<string>",
"object": "product",
"item_quantity": 123
}
]
}
},
"order": {
"id": "<string>",
"source_id": "<string>",
"status": "CREATED",
"amount": 123,
"initial_amount": 123,
"discount_amount": 123,
"items_discount_amount": 123,
"total_discount_amount": 123,
"total_amount": 123,
"applied_discount_amount": 123,
"items_applied_discount_amount": 123,
"total_applied_discount_amount": 123,
"metadata": {},
"object": "order",
"created_at": "2021-12-22T10:13:06.487Z",
"updated_at": "2021-12-22T10:14:45.316Z",
"customer_id": "cust_7iUa6ICKyU6gH40dBU25kQU1",
"referrer_id": "cust_nM4jqPiaXUvQdVSA6vTRUnix",
"customer": {
"id": "<string>",
"object": "customer"
},
"referrer": {
"id": "<string>",
"object": "customer"
},
"redemptions": {},
"items": [
{
"object": "order_item",
"id": "<string>",
"sku_id": "<string>",
"product_id": "<string>",
"related_object": "product",
"source_id": "<string>",
"quantity": 123,
"discount_quantity": 123,
"initial_quantity": 123,
"amount": 123,
"discount_amount": 123,
"applied_discount_amount": 123,
"applied_discount_quantity": 123,
"applied_quantity": 123,
"applied_quantity_amount": 123,
"initial_amount": 123,
"price": 123,
"subtotal_amount": 123,
"product": {
"id": "<string>",
"source_id": "<string>",
"override": true,
"name": "<string>",
"metadata": {},
"price": 123
},
"sku": {
"id": "<string>",
"source_id": "<string>",
"override": true,
"sku": "<string>",
"price": 123,
"metadata": {}
},
"metadata": {}
}
]
},
"applicable_to": {
"data": [
{
"object": "product",
"id": "<string>",
"effect": "APPLY_TO_EVERY",
"source_id": "<string>",
"product_id": "<string>",
"product_source_id": "<string>",
"price": 123,
"price_formula": 123,
"quantity_limit": 123,
"aggregated_quantity_limit": 123,
"amount_limit": 123,
"aggregated_amount_limit": 123,
"order_item_indices": [
123
],
"order_item_units": [
{
"index": 1,
"units": [
123
],
"units_limit_exceeded": true
}
],
"repeat": 123,
"skip_initially": 123,
"target": "ITEM"
}
],
"total": 1,
"object": "list",
"data_ref": "data"
},
"inapplicable_to": {
"data": [
{
"object": "product",
"id": "<string>",
"effect": "APPLY_TO_EVERY",
"source_id": "<string>",
"product_id": "<string>",
"product_source_id": "<string>",
"price": 123,
"price_formula": 123,
"quantity_limit": 123,
"aggregated_quantity_limit": 123,
"amount_limit": 123,
"aggregated_amount_limit": 123,
"order_item_indices": [
123
],
"order_item_units": [
{
"index": 1,
"units": [
123
],
"units_limit_exceeded": true
}
],
"repeat": 123,
"skip_initially": 123,
"target": "ITEM"
}
],
"total": 1,
"object": "list",
"data_ref": "data"
},
"metadata": {},
"categories": [
{
"id": "<string>",
"name": "<string>",
"hierarchy": 1,
"object": "category",
"created_at": "2022-07-14T10:45:13.156Z",
"updated_at": "2022-08-16T10:52:08.094Z",
"stacking_rules_type": "JOINT"
}
],
"campaign_name": "<string>",
"campaign_id": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3",
"name": "<string>"
}
],
"stacking_rules": {
"redeemables_limit": 30,
"applicable_redeemables_limit": 5,
"applicable_redeemables_per_category_limit": 1,
"applicable_redeemables_category_limits": {},
"applicable_exclusive_redeemables_limit": 1,
"exclusive_categories": [
"<string>"
],
"joint_categories": [
"<string>"
],
"redeemables_application_mode": "ALL",
"redeemables_sorting_rule": "REQUESTED_ORDER",
"redeemables_products_application_mode": "STACK",
"redeemables_no_effect_rule": "REDEEM_ANYWAY",
"no_effect_skip_categories": [
"<string>"
],
"no_effect_redeem_anyway_categories": [
"<string>"
],
"redeemables_rollback_order_mode": "WITH_ORDER",
"applicable_exclusive_redeemables_per_category_limit": 1
},
"id": "valid_101740aa2869354c6d",
"skipped_redeemables": [
{
"status": "SKIPPED",
"id": "<string>",
"object": "voucher",
"result": {
"details": {
"key": "applicable_redeemables_limit_exceeded",
"message": "Applicable redeemables limit exceeded"
}
},
"metadata": {},
"categories": [
{
"id": "<string>",
"name": "<string>",
"hierarchy": 1,
"object": "category",
"created_at": "2022-07-14T10:45:13.156Z",
"updated_at": "2022-08-16T10:52:08.094Z",
"stacking_rules_type": "JOINT"
}
],
"campaign_name": "<string>",
"campaign_id": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3",
"name": "<string>"
}
],
"inapplicable_redeemables": [
{
"status": "INAPPLICABLE",
"id": "<string>",
"object": "voucher",
"result": {
"error": {
"code": 123,
"message": "<string>",
"key": "<string>",
"details": "<string>",
"request_id": "v-0a885062c80375740f",
"resource_id": "rf_0c5d710a87c8a31f86",
"resource_type": "voucher",
"error": {
"message": "<string>"
}
},
"details": {
"message": "<string>",
"key": "<string>"
},
"bundle": {
"quantity": 50,
"limit": 50,
"identified": [
{
"id": "<string>",
"object": "product",
"item_index": 1,
"item_quantity": 123
}
],
"missing": [
{
"id": "<string>",
"object": "product",
"item_quantity": 123
}
]
}
},
"metadata": {},
"categories": [
{
"id": "<string>",
"name": "<string>",
"hierarchy": 1,
"object": "category",
"created_at": "2022-07-14T10:45:13.156Z",
"updated_at": "2022-08-16T10:52:08.094Z",
"stacking_rules_type": "JOINT"
}
],
"campaign_name": "<string>",
"campaign_id": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3",
"name": "<string>"
}
],
"order": {
"id": "<string>",
"source_id": "<string>",
"status": "CREATED",
"amount": 123,
"initial_amount": 123,
"discount_amount": 123,
"items_discount_amount": 123,
"total_discount_amount": 123,
"total_amount": 123,
"applied_discount_amount": 123,
"items_applied_discount_amount": 123,
"total_applied_discount_amount": 123,
"metadata": {},
"object": "order",
"created_at": "2021-12-22T10:13:06.487Z",
"updated_at": "2021-12-22T10:14:45.316Z",
"customer_id": "cust_7iUa6ICKyU6gH40dBU25kQU1",
"referrer_id": "cust_nM4jqPiaXUvQdVSA6vTRUnix",
"customer": {
"id": "<string>",
"object": "customer"
},
"referrer": {
"id": "<string>",
"object": "customer"
},
"redemptions": {},
"items": [
{
"object": "order_item",
"id": "<string>",
"sku_id": "<string>",
"product_id": "<string>",
"related_object": "product",
"source_id": "<string>",
"quantity": 123,
"discount_quantity": 123,
"initial_quantity": 123,
"amount": 123,
"discount_amount": 123,
"applied_discount_amount": 123,
"applied_discount_quantity": 123,
"applied_quantity": 123,
"applied_quantity_amount": 123,
"initial_amount": 123,
"price": 123,
"subtotal_amount": 123,
"product": {
"id": "<string>",
"source_id": "<string>",
"override": true,
"name": "<string>",
"metadata": {},
"price": 123
},
"sku": {
"id": "<string>",
"source_id": "<string>",
"override": true,
"sku": "<string>",
"price": 123,
"metadata": {}
},
"metadata": {},
"application_details": [
{
"source_index": 1,
"source_applied_quantity": -2,
"source_applied_quantity_amount": -1,
"target_index": 123,
"target_applied_quantity": 123,
"target_applied_quantity_amount": 123,
"target_applied_discount_amount": 123
}
]
}
]
},
"tracking_id": "track_VAVo1/z+G2GI2LPw==",
"session": {
"key": "<string>",
"type": "LOCK",
"ttl": 123,
"ttl_unit": "DAYS"
}
}The access token received from the authorization server in the OAuth 2.0 flow.
Indicates the origin (scheme, hostname, and port).
Request body schema for POST v1/validations.
An array of redeemables. You can combine voucher(s) and promotion_tier(s). Alternatively, send one uniquepromotion_stack in the array. Each unique redeemable can be sent in one request only once.
1 - 30 elementsValidate or redeem a discount code.
Show child attributes
Configure parameters returned in the response.
Show child attributes
Order information.
Show child attributes
Customer's information.
Show child attributes
Schema model for session lock object. The session object is required to establish a session between multiple parallel validation and redemption requests. If you only send the type parameter in the request, then by default the session lock will be established for 7 days. Read more on establishing a validation session.
Show child attributes
Is correspondent to Customer's source_id
A set of key/value pairs that you can attach to a redemption object. It can be useful for storing additional information about the redemption in a structured format.
Depending on your project settings: all redeemables must be valid or just one must be valid to result as valid validation. Read more in the Stacking Rule Documentation.
Response body schema for POST /validations.
The result of the validation. It takes all of the redeemables into account and returns a false if at least one redeemable is inapplicable. Returns true if all redeemables are applicable.
Lists validation results of each redeemable. If redeemables_application_mode is PARTIAL in the stacking_rules object, all redeemables here will be APPLICABLE. Read more in the Stacking rules article.
Show child attributes
Defines stacking rules for redeemables. Read more in the Stacking Rule Documentation.
Show child attributes
Unique identifier of the validation, assigned by Voucherify.
"valid_101740aa2869354c6d"
Lists validation results of each skipped redeemable.
Show child attributes
Lists validation results of each inapplicable redeemable.
Show child attributes
Order information.
Show child attributes
Hashed customer source ID.
"track_VAVo1/z+G2GI2LPw=="
Show child attributes
Was this page helpful?