Introducing OpenTelemetry for Chargebee SDKs — trace every API call in any telemetry tool.

Business Ruleset

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

id
required, string, max chars=100

Unique identifier of the business ruleset.

name
required, string, max chars=500

Display name of the business ruleset.

description
optional, string, max chars=1000

Description of what the business ruleset does.

active
required, boolean

Whether Chargebee evaluates the ruleset. Use Activate a business ruleset and Deactivate a business ruleset to change this value.

execute_mode
required, enumerated string, default=execute_all

Strategy that determines how the rules in the ruleset are evaluated and when evaluation stops.

Enum Values
stop_on_first_true

Evaluation stops as soon as a rule evaluates to true. The rules that come later in the evaluation order are not evaluated.

stop_on_first_false

Evaluation stops as soon as a rule evaluates to false. The rules that come later in the evaluation order are not evaluated.

execute_all

Every rule in the ruleset is evaluated and all the results are returned. This is the default.

execute_all_true

Every rule in the ruleset is evaluated, and only the rules that evaluated to true are returned.

updated_at
required, timestamp(UTC) in seconds

Timestamp at which the ruleset was last modified.

updated_by
optional, string, max chars=100

User or API key that last modified the ruleset.

created_by
required, string, max chars=100

User or API key that created the ruleset.

created_at
required, timestamp(UTC) in seconds

Timestamp at which the ruleset was created.

rules
optional

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.

resource_version
optional, long

Version number of this resource. Each update of the resource increments the resource_version. Concurrent updates can be detected by comparing this value across requests.