How to handle cancel event when order is cancelled

  • Posts: 21
  • Thank you received: 0
4 years 3 months ago #322651

-- HikaShop version -- : 4.3.0
-- Joomla version -- : 3.9.19
-- PHP version -- : 7.3

Hello,

I am working on custom payment plugin and I manage to make payment via third party payment. Now I want to execute some code when order is cancelled and returned back to hikashop.

Right now I am getting below URL when order is cancelled :

http://localhost/joomladev/index.php?option=com_hikashop&ctrl=order&task=cancel_order&order_id=165&Itemid=114&cancel_cg_payment=1&cg_iframe=true&txId=840ec39a-8b6d-45c2-b73e-f3f43245a56a&uniqueID=1596520852171&lang=EN

Now want to update transaction id in order table which I am getting in above url.
Also I want to show a message like "Order is cancelled".

So please let me know how to handle this particular cancel_order task in my custom payment plugin.

Thanks

Last edit: 4 years 3 months ago by ajdev33.

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
4 years 3 months ago #322654

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.

Last edit: 4 years 3 months ago by nicolas.

Please Log in or Create an account to join the conversation.

Time to create page: 0.071 seconds
Powered by Kunena Forum