Hi all, we are using espresso_track_successful_sale_gateway() to run some code that sends the registrants data to another system when they have paid. It seems this function is running even if the order status is “cancelled” or “pending payment” – how can we stop this? We only want our code to run if their status is “approved”…
We can not provide support for that function but it needs to check the current status of the registration using something like $registration->status_ID().
Then check if the status is approved before triggering the code to run.
AHEE__EE_Transaction_Processor__update_transaction_and_registrations_after_checkout_or_payment
(Fired the registration and transaction status is automatically updated)
and
AHEE__EE_Transaction_Processor__manually_update_registration_statuses
(Fired when the registration status is manually updated)
You can use the function above as a base to start your own if you prefer, the hooks are still the same ๐
Hmm, you would need to step through the transaction and confirm if a payment was made if using those hooks.
So you want a hook that will only fire once, when a payment made and it updates the transaction?
You could use ‘AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful’ instead.
That passes the EE Transaction and EE Payment objects to the hook so you can use those to pull in any needed data.
Viewing 5 reply threads
The support post ‘Trigger function when payment is confirmed’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.