Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › Add Paypal Listener Url to trigger webhook
Tagged: IPN, PayPal, web hooks, WP Affiliate
- This topic has 8 replies, 3 voices, and was last updated 6 years, 5 months ago by admin.
-
AuthorPosts
-
June 15, 2018 at 3:36 pm #14919quickregisterMember
I am creating a subscription with Paypal. I need to add a Paypal Listener url to trigger a php script on my server which triggers affiliate commissions.
This is the code I have on one of my other scripts and it works.
$paypal_ipn_listener_url = “http://www.mysite.com/paypalhook.php”;
I need to trigger this script on a sale and on recurring billing.
How do I add this hook (listener url) with your plugin?
Thank you.
June 15, 2018 at 3:49 pm #77998wzpModeratorIf you have both eStore and Affiliate Platform, the PayPal IPN back to eStore will trigger Affiliate Platform:
Or is there something else you are trying to do?
June 15, 2018 at 3:56 pm #77999quickregisterMemberI do not have YOUR affiliate script/plugin. I have my own affiliate script with active affiliates. So I need to trigger this url as a listener url for Paypal mydomain.com/paypalhook.php Again I am not using your affiliate plugin. I am just using your store. I need the store to trigger my script. Thank you.
June 15, 2018 at 4:08 pm #78000wzpModeratorI think, if you follow this thread, you might find the information you are looking for:
https://support.tipsandtricks-hq.com/forums/topic/integration-with-jrox-jam-affiliate-manager
June 15, 2018 at 4:23 pm #78001quickregisterMemberSo it takes place in paypal.php
I see the example:
$sale_amt = $this->ipn_data;
$trans_id = $this->ipn_data;
$jrox_cookie = $customvariables;
$JAMIntegrate = file_get_contents(“http://www.mydomainname.com/affiliates/sale.php?amount=”.$sale_amt.”&trans_id=”.$trans_id.”&custom_mid=”.$jrox_cookie);
$this->debug_log(‘Awarding JROX affiliate commission.’,true);
I get the cookie part. I had already seen the post
and added my cookie variables.
However is just want to have paypal call
mydomain.com/paypalhook.php
My script already does all the get contents stuff. I just need to trigger the url on sale and rebill.
Thanks,
Matt
June 15, 2018 at 11:35 pm #78002adminKeymasterWe have the following action hooks that you can use to get notified after a transaction and execute whatever code you want to from your custom code.
do_action(‘eStore_product_database_updated_after_payment’, $this->ipn_data, $cart_items);
do_action(‘eStore_paypal_recurring_payment_received’, $this->ipn_data, $cart_items);
Are you familiar with WordPress action hooks?
June 16, 2018 at 2:35 am #78003quickregisterMemberI am not familiar with this. I just need to call this page when there is a sale
mydomainname.com/payaplhook.php
Can you please direct me on where and how to do this. I have no idea about these wordpress action hooks. Please clarify. Thank you. Can you give me an example? Where do I put the hooks? Do I put the code in where it says ipn_data?
June 16, 2018 at 2:55 am #78004quickregisterMemberOk I read a bit about action hooks. Where do I define the code for the action hook and where do I put it?
If I wanted the action hook to call mydomain.com/paypalhook.php on initial subscription payment and subsequent subscription payments what it the code and where do I put it?
Thank you,
Matt
June 16, 2018 at 11:03 pm #78005adminKeymasterI am not sure that just calling that URL will do the job. An affiliate software generally needs to be integrated according to their integration guide. You also have to pass the payment parameters to them. If you think just calling the URL is enough then here is how you can do that:
Add the following code to your functions.php file of the theme. The following is just an example code so make sure you understand it and before adding to your site:
add_action('eStore_product_database_updated_after_payment', 'custom_aff_integration', 10, 2);
function custom_aff_integration ($ipn_data, $cart_items) {
$execute_url = file_get_contents("http://www.mydomainname.com/payaplhook.php");
} -
AuthorPosts
- You must be logged in to reply to this topic.