A business ruleset groups business rules so that they can be evaluated together, in the priority order you assign, using the strategy set in execute_mode.
Rulesets let you apply a whole decision at once instead of calling each rule separately. Passing a ruleset_id to Apply business rules evaluates the rules the ruleset contains in their priority order and returns a result for each one. The execute_mode decides whether evaluation runs through every rule or stops as soon as a rule evaluates to true or to false, and which of the results are returned.
Membership is managed separately from the rules themselves. Add business rules to a ruleset and Remove business rules from a ruleset change membership incrementally, while passing rules to Update a business ruleset replaces it entirely. A rule can belong to more than one ruleset, and removing it from a ruleset does not delete the rule.
The active attribute controls whether Chargebee evaluates the ruleset. A rule is evaluated through a ruleset only when both the ruleset and the rule are active.
Note: Business rules are not enabled by default. Contact Chargebee Support to enable them for your site. Until they are enabled, these endpoints return an error.
Sample Business rulesetJSON
Business Ruleset attributes
Whether Chargebee evaluates the ruleset. Use Activate a business ruleset and Deactivate a business ruleset to change this value.
Strategy that determines how the rules in the ruleset are evaluated and when evaluation stops.
Evaluation stops as soon as a rule evaluates to true. The rules that come later in the evaluation order are not evaluated.
Evaluation stops as soon as a rule evaluates to false. The rules that come later in the evaluation order are not evaluated.
Every rule in the ruleset is evaluated and all the results are returned. This is the default.
Every rule in the ruleset is evaluated, and only the rules that evaluated to true are returned.
The business rules that belong to the ruleset, each with the rule_id of the rule and the priority that determines its position in the ruleset's evaluation order. Priorities are unique within a ruleset.
Only the identifier and priority of each rule are carried here, not its expression or actions. Use List rules in a business ruleset to page through the membership of a ruleset, and Retrieve a business rule to read a rule's definition.