- This topic has 4 replies, 2 voices, and was last updated 9 years, 8 months ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- You must be logged in to reply to this topic.
Support site for Tips and Tricks HQ premium products
by
Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › estore – post payment action hook
Hi, I’m trying to get a custom php function to run at the end of a successful paypal checkout using the eestore plugin. I had a look at the post payment action plugin and tried to register my function to run using the same action hook (eStore_product_database_updated_after_payment) but i cant seem to get it to trigger all the time while testing. I’m using paypal in sandbox mode to test.
Am i using the right hook to do this or is there a better way?
Many Thanks.
There maybe a race condition happening between when the hook is being registered and when it is being triggered.
Please show me how you have added the “add_action” call for that hook so I can see if it is being registered as early as possible.
I basically took the boiler plate plugin http://tommcfarlin.github.io/WordPress-Plugin-Boilerplate/ as a base and then under public hooks registered one for estore_product_database_updated_after_payment.
$this->loader->add_action( ‘eStore_product_database_updated_after_payment’, $plugin_public, ‘custom_update_user’,10,2);
I think i know what my issue is. The products i am selling take a reoccurring payment and looking in the code i think that the estore_product_database_updated_after_payment hook only gets run for non reoccurring payments?
If so i think i need to hook into this hook (eStore_paypal_recurring_payment_received)?
Yes, for the recurring payment notifications, you need to use the following hook. See example below:
add_action('eStore_paypal_recurring_payment_received', 'my_custom_payment_tweak', 10, 2);
function my_custom_payment_tweak($ipn_data, $cart_items)
{
//Do something here
}