curl --request POST \
--url https://{cluster}.voucherify.io/management/v1/projects/{projectId}/stacking-rules \
--header 'Content-Type: application/json' \
--header 'X-Management-Id: <api-key>' \
--header 'X-Management-Token: <api-key>' \
--data '
{
"exclusive_categories": [
"<string>"
],
"joint_categories": [
"<string>"
],
"redeemables_limit": 15,
"applicable_redeemables_limit": 15,
"applicable_redeemables_per_category_limit": 15,
"applicable_redeemables_category_limits": {},
"applicable_exclusive_redeemables_limit": 3,
"applicable_exclusive_redeemables_per_category_limit": 15,
"initial_amount_mode_categories": [
"<string>"
],
"discounted_amount_mode_categories": [
"<string>"
],
"no_effect_skip_categories": [
"<string>"
],
"no_effect_redeem_anyway_categories": [
"<string>"
]
}
'{
"id": "stk_0e9bdfd48108548fd3",
"exclusive_categories": [
"cat_0f2ba1284b565c235c",
"cat_0d75bdfe4c9030a732"
],
"joint_categories": [
"cat_0d74559c3e9030da13",
"cat_0d507a4d6e8a1b7b97"
],
"redeemables_limit": 25,
"applicable_redeemables_limit": 10,
"applicable_redeemables_per_category_limit": 2,
"applicable_redeemables_category_limits": {
"cat_0d75bdfe4c9030a732": 1,
"cat_0d7c4d183011d043cc": 2
},
"applicable_exclusive_redeemables_limit": 2,
"applicable_exclusive_redeemables_per_category_limit": 2,
"discount_calculation_mode": "DISCOUNTED_AMOUNT",
"initial_amount_mode_categories": [
"cat_0d507a4d6e8a1b7b97"
],
"discounted_amount_mode_categories": [
"cat_0d7455f93c1030da4a"
],
"redeemables_application_mode": "PARTIAL",
"redeemables_sorting_rule": "CATEGORY_HIERARCHY",
"redeemables_no_effect_rule": "REDEEM_ANYWAY",
"no_effect_skip_categories": [],
"no_effect_redeem_anyway_categories": [],
"redeemables_products_application_mode": "ONCE",
"redeemables_rollback_order_mode": "WITH_ORDER",
"grouped_redeemables_sorting_rule": "JOINT_ALWAYS_LAST",
"created_at": "2024-04-16T20:18:38.213Z"
}{
"code": 400,
"key": "invalid_payload",
"message": "Invalid payload",
"details": "Property .applicable_exclusive_redeemables_limit must be <= 30",
"request_id": "v-0e9b7334154228a45f"
}{
"code": 401,
"message": "Unauthorized",
"key": "unauthorized"
}{
"code": 402,
"message": "Payment required",
"details": "Your current plan does not include a feature required to perform this operation.",
"key": "missing_required_feature"
}{
"code": 404,
"key": "not_found",
"message": "Resource not found",
"details": "Cannot find customer with id cust_xqA7DGj5eYPHg6PHVKwYRWiA",
"request_id": "v-0c8b6b35294af6f192",
"resource_id": "cust_xqA7DGj5eYPHg6PHVKwYRWiA",
"resource_type": "customer"
}{
"code": 409,
"key": "stacking_rules_exist",
"message": "Stacking rules exist",
"details": "Cannot exist more stacking rules for given project",
"request_id": "v-0e9b5f39f550e070c4"
}Create Stacking Rules
Overwrites the default stacking rules.
If new stacking rules have been created for the project earlier (e.g. in the user interface), it returns an error. Use Update stacking rules endpoint to change the rules.
Read the Stacking rules article to learn how they work.
curl --request POST \
--url https://{cluster}.voucherify.io/management/v1/projects/{projectId}/stacking-rules \
--header 'Content-Type: application/json' \
--header 'X-Management-Id: <api-key>' \
--header 'X-Management-Token: <api-key>' \
--data '
{
"exclusive_categories": [
"<string>"
],
"joint_categories": [
"<string>"
],
"redeemables_limit": 15,
"applicable_redeemables_limit": 15,
"applicable_redeemables_per_category_limit": 15,
"applicable_redeemables_category_limits": {},
"applicable_exclusive_redeemables_limit": 3,
"applicable_exclusive_redeemables_per_category_limit": 15,
"initial_amount_mode_categories": [
"<string>"
],
"discounted_amount_mode_categories": [
"<string>"
],
"no_effect_skip_categories": [
"<string>"
],
"no_effect_redeem_anyway_categories": [
"<string>"
]
}
'{
"id": "stk_0e9bdfd48108548fd3",
"exclusive_categories": [
"cat_0f2ba1284b565c235c",
"cat_0d75bdfe4c9030a732"
],
"joint_categories": [
"cat_0d74559c3e9030da13",
"cat_0d507a4d6e8a1b7b97"
],
"redeemables_limit": 25,
"applicable_redeemables_limit": 10,
"applicable_redeemables_per_category_limit": 2,
"applicable_redeemables_category_limits": {
"cat_0d75bdfe4c9030a732": 1,
"cat_0d7c4d183011d043cc": 2
},
"applicable_exclusive_redeemables_limit": 2,
"applicable_exclusive_redeemables_per_category_limit": 2,
"discount_calculation_mode": "DISCOUNTED_AMOUNT",
"initial_amount_mode_categories": [
"cat_0d507a4d6e8a1b7b97"
],
"discounted_amount_mode_categories": [
"cat_0d7455f93c1030da4a"
],
"redeemables_application_mode": "PARTIAL",
"redeemables_sorting_rule": "CATEGORY_HIERARCHY",
"redeemables_no_effect_rule": "REDEEM_ANYWAY",
"no_effect_skip_categories": [],
"no_effect_redeem_anyway_categories": [],
"redeemables_products_application_mode": "ONCE",
"redeemables_rollback_order_mode": "WITH_ORDER",
"grouped_redeemables_sorting_rule": "JOINT_ALWAYS_LAST",
"created_at": "2024-04-16T20:18:38.213Z"
}{
"code": 400,
"key": "invalid_payload",
"message": "Invalid payload",
"details": "Property .applicable_exclusive_redeemables_limit must be <= 30",
"request_id": "v-0e9b7334154228a45f"
}{
"code": 401,
"message": "Unauthorized",
"key": "unauthorized"
}{
"code": 402,
"message": "Payment required",
"details": "Your current plan does not include a feature required to perform this operation.",
"key": "missing_required_feature"
}{
"code": 404,
"key": "not_found",
"message": "Resource not found",
"details": "Cannot find customer with id cust_xqA7DGj5eYPHg6PHVKwYRWiA",
"request_id": "v-0c8b6b35294af6f192",
"resource_id": "cust_xqA7DGj5eYPHg6PHVKwYRWiA",
"resource_type": "customer"
}{
"code": 409,
"key": "stacking_rules_exist",
"message": "Stacking rules exist",
"details": "Cannot exist more stacking rules for given project",
"request_id": "v-0e9b5f39f550e070c4"
}Path Parameters
Body
Defines the stacking rule parameters.
Request body schema for POST /management/v1/projects/{projectId}/stacking-rules.
Defines how many redeemables can be applied in one request. The number must be less than or equal to redeemables_limit. For example, a user can select 30 discounts but only 5 will be applied to the order and the remaining will be SKIPPED according to the redeemables_sorting_rule.
1 <= x <= 30Defines how many redeemables with the same category can be applied in one request. The number must be less than or equal to applicable_redeemables_limit. The ones above the limit will be SKIPPED according to the redeemables_sorting_rule.
1 <= x <= 30Defines how many redeemables with an assigned exclusive category can be applied in one request. The ones above the limit will be SKIPPED according to the redeemables_sorting_rule. The number must be less than or equal to applicable_exclusive_redeemables_limit.
1 <= x <= 30Defines the application mode for redeemables.
"ALL" means that all redeemables must be validated for the redemption to be successful.
"PARTIAL" means that only those redeemables that can be validated will be redeemed. The redeemables that fail validaton will be skipped.
ALL, PARTIAL Defines redeemables sorting rule. CATEGORY_HIERARCHY means that redeemables are applied oaccording to the category priority. REQUESTED_ORDER means that redeemables are applied in the sequence provided in the request.
CATEGORY_HIERARCHY, REQUESTED_ORDER Defines redeemables no effect rule. REDEEM_ANYWAY means that the redeemable will be redeemed regardless of any restrictions or conditions in place. SKIP means that the redeemable will be processed only when an applicable effect is calculated.
REDEEM_ANYWAY, SKIP Defines the rollback mode for the order. WITH_ORDER is a default setting. The redemption is rolled back together with the data about the order, including related discount values. WITHOUT_ORDER allows rolling the redemption back without affecting order data, including the applied discount values.
WITH_ORDER, WITHOUT_ORDER Response
Returns the details about the stacking rules assigned to the project.
Response body schema for POST /management/v1/projects/{projectId}/stacking-rules.
Defines how many redeemables can be applied in one request. The number must be less than or equal to redeemables_limit. For example, a user can select 30 discounts but only 5 will be applied to the order and the remaining will be SKIPPED according to the redeemables_sorting_rule.
1 <= x <= 30Defines how many redeemables with the same category can be applied in one request. The number must be less than or equal to applicable_redeemables_limit. The ones above the limit will be SKIPPED according to the redeemables_sorting_rule.
1 <= x <= 30Defines how many redeemables with an assigned exclusive category can be applied in one request. The ones above the limit will be SKIPPED according to the redeemables_sorting_rule. The number must be less than or equal to applicable_exclusive_redeemables_limit.
1 <= x <= 30Defines the application mode for redeemables.
"ALL" means that all redeemables must be validated for the redemption to be successful.
"PARTIAL" means that only those redeemables that can be validated will be redeemed. The redeemables that fail validaton will be skipped.
ALL, PARTIAL Defines redeemables sorting rule. CATEGORY_HIERARCHY means that redeemables are applied oaccording to the category priority. REQUESTED_ORDER means that redeemables are applied in the sequence provided in the request.
CATEGORY_HIERARCHY, REQUESTED_ORDER Defines redeemables no effect rule. REDEEM_ANYWAY means that the redeemable will be redeemed regardless of any restrictions or conditions in place. SKIP means that the redeemable will be processed only when an applicable effect is calculated.
REDEEM_ANYWAY, SKIP Defines the rollback mode for the order. WITH_ORDER is a default setting. The redemption is rolled back together with the data about the order, including related discount values. WITHOUT_ORDER allows rolling the redemption back without affecting order data, including the applied discount values.
WITH_ORDER, WITHOUT_ORDER 
