Get a discount when paying by credit card
Rule breakdown, resource payload analysis, and outcomes explanation
This rule applies a discount to an order based on the payment method. The order's payment source type is checked and a percentage discount is applied to the order's total amount if the conditions are met.
The example below is based on the following reference JSONs. Once the rules are evaluated against the resource payload, the outcomes show if and how the conditions are matched and the related actions applied.
Rules breakdown
The desired results can be achieved with a single rule.
Conditions
The only condition in the rule checks if the payment source type associated with the order is credit_card
.
Actions
The only action in the rule applies a 3% discount to the whole order amount if the condition is met.
Resource payload analysis
The provided payload contains an order with an associated payment source type that is credit_card
, thus qualifying for the discount.
Outcomes check
The outcomes reflect the evaluation of the rules against the resource payload. Since the order's payment source satisfies the condition, the rule matches successfully (match
is true
). The order line items to which the discount is applied and the related payment methods are listed within the matches
array. The action is applied to the order with the decimal value of 0.03
corresponding to the specified percentage discount.
Conclusion
The rule matches the provided order payload. Consequently, a 3% discount is applied to the order's total amount due to the payment method being a credit card.
Last updated