Hello,
Well, what you can do is tell the payment gateway to redirect to the payment notification URL with some extra parameter, and in the onPaymentNotification function of your plugin you can do whatever you want and then redirect your customers to the cancel URL yourself.
Alternatively, you can keep it the way you have it, and implement the onAfterOrderUpdate trigger in your plugin so that you'll be able do your code when the cancel URL cancels the order, but in that case, you need to do some checks as that trigger will be called whenever the order is changed (in the backend, by another plugin, for other payment plugins, etc), and you might not want to do any processing in your plugin in most cases the trigger is called.
Kind regards,
Mohamed.