Cancellation Strategies

A total of 19 distinct cancellation and return strategies designed to handle different scenarios of order cancellation, refund, and ERP integration. Each strategy defines specific rules regarding how shipping fees, discounts, payments, and ERP reporting are managed, ensuring that cancellations and returns comply with both business requirements and operational constraints.

The selected strategy is determined by its strategy ID, which must be created or updated by sending a POST request to the endpoint:

api/v1/dynamic_settings

The dynamic setting for cancellation strategy has the following structure:

{
    "key": "CANCELLATION_STRATEGY",
    "description": null,
    "default": "StrategyOne",
    "validators": []
}
  • key: "CANCELLATION_STRATEGY" — the identifier for the cancellation strategy setting.

  • default: "StrategyOne" — by default, the system uses Strategy 1 unless explicitly configured otherwise.

  • validators: An optional array of validation rules for the setting.

Strategy 1

The StrategyOne class inherits from the CancellationStrategy class, with the following rules:

  • If the cancellation_type of the order is cancel or refund, the shipping fee can be refunded. In other cases, it raises a NotImplementedError.

  • Discounts can be refunded.

  • Partial cancellations are allowed.

  • Shipping fees are not divided per item.

  • All items are refundable.

  • If the cancellation_type of the order is refund, it cannot be sent to ERP. In other cases, it can be sent.

  • Payments can be refunded.

  • Orders that are not reported to ERP can be canceled if the order status is payment_waiting, or it cannot be sent to ERP (can_be_sent_to_erp=False), or if the order has already been sent to ERP (is_send=True).

  • For cash-on-delivery orders, if the cancellation_type is cancel, the payment_option_fee can be refunded.

Strategy 2

The StrategyTwo class inherits from StrategyOne, with the following rules. The rules that differ from StrategyOne are highlighted in blue.

  • If the cancellation_type of the order is cancel or refund, the shipping fee can be refunded. In other cases, it raises a NotImplementedError.

  • Discounts can be refunded.

  • Partial cancellations are allowed.

  • Shipping fees are not divided per item.

  • All items are refundable.

  • Can be sent to ERP.

  • Payments can be refunded.

  • Orders that are not reported to ERP can be canceled if the order status is payment_waiting, it cannot be sent to ERP (can_be_sent_to_erp=False), or if the order has already been sent to ERP (is_send=True).

  • It creates a plan using the PaymentPlanStrategyOne class.

  • For cash-on-delivery orders, if the cancellation_type is cancel, the payment_option_fee can be refunded.

Strategy 3

The StrategyThree class inherits from StrategyOne, with the following rules. The rules that differ from StrategyOne are highlighted in blue.

  • If the cancellation_type of the order is cancel, the shipping fee can be refunded. If it is refund, the shipping fee cannot be refunded.

  • Discounts can be refunded.

  • Partial cancellations are allowed.

  • Shipping fees are not divided per item.

  • All items are refundable.

  • Cannot be sent to ERP.

  • Payments can be refunded.

  • Orders that are not reported to ERP can be canceled if the order status is payment_waiting, or it cannot be sent to ERP (can_be_sent_to_erp=False), or if the order has already been sent to ERP (is_send=True).

  • It creates a plan using the PaymentPlanStrategyOne class.

  • For cash-on-delivery orders, if the cancellation_type is cancel, the payment_option_fee can be refunded.

Strategy 4

The StrategyFour class inherits from StrategyOne and follows the rules listed below. The rules that differ from StrategyOne are highlighted in blue.

  • If the cancellation_type of the order is cancel or refund, the shipping fee can be refunded. In other cases, it raises a NotImplementedError.

  • Discounts can be refunded.

  • Partial cancellations are allowed.

  • Shipping fees are not divided per item.

  • All items are refundable.

  • If the order’s cancellation_type is cancel, it can be sent to ERP; if refund, it cannot be sent to ERP.

  • Payments cannot be refunded.

  • Orders that are not reported to ERP can be canceled if the order status is payment_waiting, or it cannot be sent to ERP (can_be_sent_to_erp=False), or if the order has already been sent to ERP (is_send=True).

  • It creates a plan using the PaymentPlanStrategyOne class.

  • For cash-on-delivery orders, if the cancellation_type is cancel, the payment_option_fee can be refunded.

Strategy 5

The StrategyFive class inherits from StrategyOne and follows the rules listed below. The rules that differ from StrategyOne are highlighted in blue.

  • If the order’s cancellation_type is ‘cancel’, the shipping cost can be refunded; if it is ‘refund’, the shipping cost cannot be refunded.

  • Discounts can be refunded.

  • Partial cancellations are allowed.

  • Shipping fees are not divided per item.

  • All items are refundable.

  • Cannot be sent to ERP.

  • Payments can be refunded.

  • Orders that are not reported to ERP can be canceled if the order status is payment_waiting, or it cannot be sent to ERP (can_be_sent_to_erp=False), or if the order has already been sent to ERP (is_send=True).

  • It creates a plan using the PaymentPlanStrategyOne class.

  • For cash-on-delivery orders, if the cancellation_type is cancel, the payment_option_fee can be refunded.

Strategy 6

The StrategySix class inherits from StrategyOne and follows the rules listed below. The rules that differ from StrategyOne are highlighted in blue.

  • If the order’s cancellation_type is ‘cancel’, the shipping cost can be refunded; if it is ‘refund’, the shipping cost cannot be refunded.

  • Discounts can be refunded.

  • Partial cancellations are allowed.

  • Shipping fees are not divided per item.

  • All items are refundable.

  • If the cancellation_type of the order is refund, it cannot be sent to ERP. In other cases, it can be sent.

  • Payments can be refunded.

  • Orders that are not reported to ERP can be canceled if the order status is payment_waiting, or it cannot be sent to ERP (can_be_sent_to_erp=False), or if the order has already been sent to ERP (is_send=True).

  • It creates a plan using the PaymentPlanStrategyOne class.

  • For cash-on-delivery orders, if the cancellation_type is cancel, the payment_option_fee can be refunded.

Strategy 7

The StrategySeven class inherits from StrategyTwo and follows the rules listed below. The rules that differ from StrategyTwo are highlighted in blue.

  • If the order’s cancellation_type is cancel, the shipping cost can be refunded; if it is refund, the shipping cost cannot be refunded.

  • Discounts can be refunded.

  • If the order’s cancellation_type is cancel and the order has not been delivered, or if the cancellation_type is refund and the order has not been delivered, partial cancellation is not allowed. In other cases, partial cancellation is allowed.

  • Shipping fees are not divided per item.

  • All items are refundable.

  • If the cancellation_type of the order is refund, it cannot be sent to ERP. In other cases, it can be sent.

  • Payments can be refunded.

  • Orders that are not reported to ERP can be canceled if the order status is payment_waiting or confirmation_waiting, or it cannot be sent to ERP (can_be_sent_to_erp=False), or if the order has already been sent to ERP (is_send=True).

  • It creates a plan using the PaymentPlanStrategyTwo class.

  • For cash-on-delivery orders, if the cancellation_type is cancel, the payment_option_fee can be refunded.

Strategy 8

The StrategyEight class inherits from StrategyOne and follows the rules listed below. The rules that differ from StrategyOne are highlighted in blue.

  • If the cancellation_type of the order is cancel or refund, the shipping fee can be refunded. In other cases, it raises a NotImplementedError.

  • Discounts can be refunded.

  • Partial cancellations are allowed.

  • Shipping fees are not divided per item.

  • All items are refundable.

  • If the cancellation_type of the order is cancel, it cannot be sent to ERP. In other cases, it can be sent.

  • Payments can be refunded.

  • Orders that are not reported to ERP can be canceled if the order status is payment_waiting, or it cannot be sent to ERP (can_be_sent_to_erp=False), or if the order has already been sent to ERP (is_send=True).

  • It creates a plan using the PaymentPlanStrategyOne class.

  • For cash-on-delivery orders, if the cancellation_type is cancel, the payment_option_fee can be refunded.

Strategy 9

The StrategyNine class inherits from StrategyOne and follows the rules listed below. The rules that differ from StrategyOne are highlighted in blue.

  • If the cancellation_type of the order is cancel or refund, the shipping fee can be refunded. In other cases, it raises a NotImplementedError.

  • Discounts can be refunded.

  • Partial cancellations are allowed.

  • Shipping fees are not divided per item.

  • All items are refundable.

  • Cannot be sent to ERP.

  • Payments can be refunded.

  • Orders that are not reported to ERP can be canceled if the order status is payment_waiting, or it cannot be sent to ERP (can_be_sent_to_erp=False), or if the order has already been sent to ERP (is_send=True).

  • It creates a plan using the PaymentPlanStrategyOne class.

  • For cash-on-delivery orders, if the cancellation_type is cancel, the payment_option_fee can be refunded.

Strategy 10

The StrategyTen class inherits from StrategyEight and follows the rules listed below. The rules that differ from StrategyEight are highlighted in blue.

  • If the cancellation_type of the order is cancel or refund, the shipping fee can be refunded. In other cases, it raises a NotImplementedError.

  • Discounts can be refunded.

  • If there are order items, and any item's status is other than approved, and the cancellation_type is cancel, partial cancellation is not allowed. In other cases, partial cancellations can be made.

  • Shipping fees are not divided per item.

  • All items are refundable.

  • If the cancellation_type of the order is cancel, it cannot be sent to ERP. In other cases, it can be sent.

  • Payments can be refunded.

  • Orders that are not reported to ERP can be canceled if the order status is payment_waiting, or it cannot be sent to ERP (can_be_sent_to_erp=False), or if the order has already been sent to ERP (is_send=True).

  • It creates a plan using the PaymentPlanStrategyOne class.

  • For cash-on-delivery orders, if the cancellation_type is cancel, the payment_option_fee can be refunded.

Strategy 11

The StrategyEleven class inherits from StrategyOne and follows the rules listed below. The rules that differ from StrategyOne are highlighted in blue.

  • If the cancellation_type of the order is cancel or refund, the shipping fee can be refunded. In other cases, it raises a NotImplementedError.

  • Discounts can be refunded.

  • Partial cancellations are allowed.

  • Shipping fees are not divided per item.

  • All items are refundable.

  • If the cancellation_type of the order is refund, it cannot be sent to ERP. In other cases, it can be sent.

  • Payments cannot be refunded.

  • Cancellations can be performed on orders not reported to ERP.

  • It creates a plan using the PaymentPlanStrategyOne class.

  • For cash-on-delivery orders, if the cancellation_type is cancel, the payment_option_fee can be refunded.

Strategy 12

The StrategyTwelve class inherits from StrategyOne and follows the rules listed below. The rules that differ from StrategyOne are highlighted in blue.

  • If the cancellation_type of the order is cancel or refund, the shipping fee can be refunded. In other cases, it raises a NotImplementedError.

  • Discounts can be refunded.

  • Partial cancellations are allowed.

  • Shipping fees are not divided per item.

  • All items are refundable.

  • If the cancellation_type of the order is refund, it cannot be sent to ERP. In other cases, it can be sent.

  • Payments can be refunded.

  • Orders that are not reported to ERP can always be canceled. In other cases:

    • If the order status is payment_waiting, or

    • If the order cannot be sent to ERP (can_be_sent_to_erp=False), or

    • If the order has already been sent to ERP (is_send=True),

  • It creates a plan using the PaymentPlanStrategyOne class.

  • For cash-on-delivery orders, if the cancellation_type is cancel, the payment_option_fee can be refunded.

Strategy 13

The StrategyThirteen class inherits from StrategyTwo, with the following rules. The rules that differ from StrategyTwo are highlighted in blue.

  • Shipping fees cannot be refunded.

  • Discounts can be refunded.

  • Partial cancellations are allowed.

  • Shipping fees are not divided per item.

  • All items are refundable.

  • Can be sent to ERP.

  • Payments can be refunded.

  • Orders that are not reported to ERP can be canceled if the order status is payment_waiting, it cannot be sent to ERP (can_be_sent_to_erp=False), or if the order has already been sent to ERP (is_send=True).

  • It creates a plan using the PaymentPlanStrategyOne class.

  • For cash-on-delivery orders, if the cancellation_type is cancel, the payment_option_fee can be refunded.

Strategy 14

The StrategyFourteen class inherits from StrategyTwo, with the following rules. The rules that differ from StrategyTwo are highlighted in blue.

  • If the cancellation_type of the order is cancel or refund, the shipping fee can be refunded. In other cases, it raises a NotImplementedError.

  • Discounts can be refunded.

  • If the cancellation_type is cancel, partial cancellation is not allowed. In other cases, partial cancellations can be made.

  • Shipping fees are not divided per item.

  • All items are refundable.

  • Can be sent to ERP.

  • Payments can be refunded.

  • Orders that are not reported to ERP can be canceled if the order status is payment_waiting, it cannot be sent to ERP (can_be_sent_to_erp=False), or if the order has already been sent to ERP (is_send=True).

  • It creates a plan using the PaymentPlanStrategyOne class.

  • For cash-on-delivery orders, if the cancellation_type is cancel, the payment_option_fee can be refunded.

Strategy 15

The StrategyFifteen class inherits from StrategyTwelve and follows the rules listed below. The rules that differ from StrategyTwelve are highlighted in blue.

  • If the cancellation_type of the order is cancel or refund, the shipping fee can be refunded. In other cases, it raises a NotImplementedError.

  • Discounts can be refunded.

  • Partial cancellations are allowed.

  • Shipping fees are not divided per item.

  • All items are refundable.

  • It can be sent to ERP.

  • Payments can be refunded.

  • Orders that are not reported to ERP can be canceled if the order status is payment_waiting, or it cannot be sent to ERP (can_be_sent_to_erp=False), or if the order has already been sent to ERP (is_send=True).

  • It creates a plan using the PaymentPlanStrategyOne class.

  • For cash-on-delivery orders, if the cancellation_type is cancel, the payment_option_fee can be refunded.

Strategy 16

The StrategySixteen class inherits from StrategyTwo, with the following rules. The rules that differ from StrategyTwo are highlighted in blue.

  • If the cancellation_type of the order is cancel or refund, the shipping fee can be refunded. In other cases, it raises a NotImplementedError.

  • Discounts can be refunded.

  • Partial cancellations are allowed.

  • Shipping fees are not divided per item.

  • All items are refundable.

  • Can be sent to ERP.

  • Payments are refundable except for cash-on-delivery refund scenarios.

  • The scenarios for canceling orders that have not been reported to the ERP are as follows:

    • If the order's cancellation_type is cancel, all orders can be canceled.

    • If the order's cancellation_type is refund:

      • If the order's status is payment_waiting, or if it cannot be sent to ERP (can_be_sent_to_erp=False), or if the order has been sent to ERP (is_send=True), it can be canceled.

  • It creates a plan using the PaymentPlanStrategyOne class.

  • For cash-on-delivery orders, if the cancellation_type is cancel, the payment_option_fee can be refunded.

Strategy 17

The StrategySeventeen class inherits from StrategyThree, with the following rules. The rules that differ from StrategyThree are highlighted in blue.

  • If the cancellation_type of the order is cancel, the shipping fee can be refunded. If it is refund, the shipping fee cannot be refunded.

  • Discounts can be refunded.

  • Partial cancellations are allowed.

  • Shipping fees are not divided per item.

  • All items are refundable.

  • Cannot be sent to ERP.

  • Payments can be refunded.

  • Orders that have not been reported to the ERP cannot be canceled.

  • It creates a plan using the PaymentPlanStrategyOne class.

  • For cash-on-delivery orders, if the cancellation_type is cancel, the payment_option_fee can be refunded.

Strategy 18

The StrategyEighteen class inherits from StrategySix and follows the rules listed below. The rules that differ from StrategySix are highlighted in blue.

  • If the order’s cancellation_type is cancel, the shipping cost can be refunded; if it is refund, the shipping cost cannot be refunded.

  • Discounts can be refunded.

  • Partial cancellations are allowed.

  • Shipping fees are not divided per item.

  • All items are refundable.

  • It can be sent to ERP.

  • Payments cannot be refunded.

  • Orders that are not reported to ERP can be canceled if the order status is payment_waiting, or it cannot be sent to ERP (can_be_sent_to_erp=False), or if the order has already been sent to ERP (is_send=True).

  • It creates a plan using the PaymentPlanStrategyOne class.

  • For cash-on-delivery orders, if the cancellation_type is cancel, the payment_option_fee can be refunded.

Strategy 19

The StrategyNineteen class inherits from StrategyOne and follows the rules listed below. The rules that differ from StrategyOne are highlighted in blue.

  • If the order's cancellation_type is cancel, shipping can be refunded. If it is refund, shipping cannot be refunded.

  • Discounts can be refunded.

  • Partial cancellations are allowed.

  • Shipping fees are not divided per item.

  • All items are refundable.

  • It can be sent to ERP.

  • Payments can be refunded.

  • Orders that have not been reported to the ERP cannot be canceled.

  • It creates a plan using the PaymentPlanStrategyOne class.

  • For cash-on-delivery orders, if the cancellation_type is cancel, the payment_option_fee can be refunded.

Comparison of Strategies

The comparison of cancellation strategies based on their features is provided in the table below.

Last updated

Was this helpful?