Jump to content

API Call triggered by hookdisplayOrderConfirmation


Recommended Posts

Hello All,

I'm building a custom module that is hooked into hookdisplayOrderConfirmation, my goal is to have an api call made when an order is confirmed to trigger the digital activation of a service that I'm providing.

I have the hook registered properly in my module as it shows in the hook but when I process an order it doesn't work, I even changed the code to echo a statement and exit so that I could at least see that it was being processed but even that didn't work. Is there a hook that would better suit what I'm trying to do? 

Honestly I think it would be better suited to be hooked into something that confirms that the payment is processed and then flags my api call to be made.

Edited by 736Online2 (see edit history)
Link to comment
Share on other sites

7 minutes ago, Krystian Podemski said:

It would be better to hook this call into actionValidateOrder :)

I was able to get it at least working by using hookActionPaymentConfirmation, but with actionValidateOrder would that be validating an accepted payment?

Link to comment
Share on other sites

actionValidateOrder is a Hook which is available in classes/PaymentModule.php, ValidateOrder method is responsible for creating an order in PrestaShop, so this method is being called after placing an order

If you want you can also hook into actionOrderStatusUpdate - thanks to this hook you can get information every time order state have been changed, in your code you need to check if order has a state like "Paid" or something

Link to comment
Share on other sites

1 hour ago, Krystian Podemski said:

actionValidateOrder is a Hook which is available in classes/PaymentModule.php, ValidateOrder method is responsible for creating an order in PrestaShop, so this method is being called after placing an order

If you want you can also hook into actionOrderStatusUpdate - thanks to this hook you can get information every time order state have been changed, in your code you need to check if order has a state like "Paid" or something

Update:

I was able to run a successful test using hookActionPaymentConfirmation. I found documentation stating the following:

actionPaymentConfirmation Called when an order's status becomes "Payment accepted".

 

Just to be safe I ran the order through every payment status to make sure the api call wasn't made and it never fired until I put it in the Payment Accepted status.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...