This article describes the best approach for detecting OrderIsPaid Change.
If you had ever faced a requirement to detect changes of the OrderIsPaid column, you have most likely found that using Custom Global Event Handlers for this is less than optimal. This is because the event is fired on every Order change, and not just the OrderIsPaid change. The solution is to add an additional OrderIsPaid status for tracking and comparison of this column.
The best approach to this problem is to avoid Event Handlers altogether, by using a Custom Provider that overrides the default ProcessOrderIsPaidChangeInternal method. An example provider could look like this:
/// Customized CustomOrderInfoProvider.cs provider.
public class CustomOrderInfoProvider : OrderInfoProvider
/// Process order items of given order according to order is paid change.
/// <param name="oi">Order</param>
protected override void ProcessOrderIsPaidChangeInternal(OrderInfo oi)
// If order is paid
// Order has been paid, your code here
// Order has been moved from paid back to not paid.
Since this code calls the base method at the end, the default functionality is not interrupted.
Please note that you will also need to create a custom provider loader, as described in the article linked bellow. You can find example implementation of the above Custom Provider, as well as Custom Provider Loader in the article attachments
See also: Custom Providers
Applies to: Kentico CMS 7