Page 1 of 1

[Newbie] How do i call an external api after a successful order and send the details?

Posted: Thu Feb 29, 2024 7:41 pm
by narcisskylake
I have tried creating an event hook, but still can't get it to work.
I need the order details (customer, products, etc.) to be passed on an external api.
I've tried looking all over but can't find any article where it helps you go through step by step on how to create a custom event.
Most are outdated, and I am out of options but to ask for your help for a detailed explanation or take a look over what I currently have

I'm using OpenCart 4.0.2.3
I attached what I have been trying.

Re: [Newbie] How do i call an external api after a successful order and send the details?

Posted: Sat Mar 02, 2024 10:06 am
by straightlight
Your event parameters should not use affected types with your referenced variables. The conventional name you use for the filename: callExternalApi with the controller name is also unmatched, both, on the admin and the catalog-end. It should be: call_external_api.php based on the conventional name you provided on the controller extended classes with the namespaces and also on the admin install() and uninstall() callExternalApi you're using.

For further analysis with the events, you can also test them by using the debug event.