Home › Forums › Community Forum › Help with paypal-central-ipn.php and IPN
This topic contains 13 replies, has 4 voices. Last updated by Cristián Lávaque 4 years, 6 months ago.
Topic Author | Topic |
---|---|
Posted: Wednesday Jun 6th, 2012 at 8:53 pm #15735 | |
|
|
I recently changed domains for my site. Since PayPal stores individual IPN URLs indefinitely for the subscriber profiles that have been created before the switch, all the notifications for these users are going to http://old_domain.com/?s2_member_notify=1 (instead of http://new_domain.com/?s2_member_notify=1). So I’m trying to set up a script to redirect those notifications from the old domain to the new. Everything seems to be working fine, except that the notifications are not firing on the new server… Instead of sending the cURL request to http://new_domain.com/?s2_member_notify=1 I tried sending it to a custom script that only echoes $_POST variables, and that worked. So apparently the cURL call succeeds, but something breaks down afterwards with the s2member_notify script. Any idea what could be the problem? My second question is, where is the script that handles incoming notifications located in the s2member files? I would like to insert some logging calls to make sure the variables are being received properly. Thanks! |
List Of Topic Replies
Author | Replies |
---|---|
Author | Replies |
Posted: Thursday Jun 7th, 2012 at 10:35 am #15787 | |
![]() |
|
Sacha, Have you updated your IPN URL in PayPal with the new URL? To the best of my knowledge, PayPal will begin sending new IPN messages for existing subscriptions to the new IPN URL if you update PayPal with it. I could not find any documentation that stated this was not the case. If you know of some, could you link me to it? |
|
Posted: Thursday Jun 7th, 2012 at 7:48 pm #15858 | |
|
|
I did update the global IPN URL, and it wasn’t effective. And I got in touch with PayPal support directly and they told me you couldn’t change individual IPN URL, sorry I don’t have a more specific source. |
|
Posted: Friday Jun 8th, 2012 at 9:34 pm #16011 | |
|
|
I’ve confirmed that the cURL call is passing the POST variables from one domain to the other, but nothing happens after this. Any idea why? If not, could you tell me where the code that deals with this is located in the S2Member plugin files? Also, for some reason PayPal seems to be sending each notification twice… Will that be a problem, or is S2Member smart enough to ignore the second one? |
|
Posted: Friday Jun 8th, 2012 at 10:27 pm #16022 | |
![]() |
|
Thanks for the follow-up.
Yes, that’s fine. s2Member will ignore duplicates. However, the fact that you’re getting duplicates, usually indicates that PayPal thinks the IPN is not being received properly. If you’d like, you can use the central-ipn-sample.php file that we’ve prepared. It can certainly work for you in this situation. I’m attaching a copy to this post for you. Upload this file to your old domain, and make sure it accepts requests for the old IPN location (i.e. the one PayPal is still trying to send IPNs to). At the top of the file, you’ll find the configuration section.
You will also need to run a search/replace on the IPN POST data, to replace occurrences of old-domain, with new-domain, BEFORE you actually forward the IPN. The sample script does NOT do this, so that’s something you will need a couple lines of custom code for.
s2Member already logs all of the incoming IPNs that it receives. You’ll just need to enable logging from your Dashboard. Dashboard -› s2Member® -› PayPal® Options -› Account Details -› Logging After you enable logging, you can check s2Member’s log, and you should find the issue there. |
|
Posted: Friday Jun 8th, 2012 at 10:29 pm #16024 | |
![]() |
|
Sorry, here’s the file attachment:
http://www.s2member.com/wp-content/downloads/s2m-pro-extras.zip This is also included in the s2m-pro-extras.zip file, |
|
Posted: Saturday Jun 9th, 2012 at 2:06 am #16042 | |
|
|
I’ve done exactly this. I’m at a point where everything seems to be set up properly, the POST variables are sent from one site to the other, yet the notifications are not firing from new-domain.com?s2member_paypal_notify=1 If there are any common reasons why this might happen I’d love to know, otherwise I would also like to know where this behavior is handled in the S2member plugin files so that I can try and figure out what’s happening by myself. |
|
Posted: Tuesday Jun 12th, 2012 at 8:13 pm #16303 | |
|
|
Any help with this? All I’d like to know is where to look for the class or function that deals with incoming notifications in the S2Member plugin files? |
|
Posted: Tuesday Jun 12th, 2012 at 10:26 pm #16317 | |
|
|
I had completely forgotten about the IPN logs. I checked them and it turns out there’s an error:
Just to be clear, IPN are working fine from PayPal to NRFight.tv (the new domain). It’s only when PayPal sends the IPN to NRFight.com (the old domain), and NRFight.com forwards it to NRFight.tv that this problem occurs.
|
|
Posted: Tuesday Jun 12th, 2012 at 10:54 pm #16326 | |
![]() |
|
Thanks for the follow-up.Yes, I’m so sorry. I left out one key component that MUST be implemented before this is going to work. When s2Member finally receives the forwarded IPN data, it is posted back to PayPal for verification. However, since you’re changing the data in the IPN response itself, which is required in your case (i.e. the old-domain is changing to that of your new-domain); PayPal is not going to verify it, because the data is different now. The solution to this, is to force verification. This can be accomplished with the use of an s2Member Proxy Key, which is sent to the IPN handler. All you really need to do, is change this line in the configuration section of the central IPN handler. I’ve written instructions below. Instead of just this:
You will need this (including the proxy verification):
Before you can make this change, you will need to log into your s2Member installation, and check this section of your Dashboard. Here you will find the full Proxy IPN URL (which includes a Proxy Key for your installation). See: Dashboard -› s2Member® -› PayPal® Options -› PayPal® IPN Integration -> IPN w/ Proxy Key |
|
Posted: Tuesday Jun 12th, 2012 at 11:20 pm #16328 | |
|
|
It worked! Well, I got rid of the errors in the IPN logs at least. I haven’t received the email notification, but that might be because I’m using old transaction data to test my setup and S2Member (or PayPal) doesn’t want to fire the same IPN twice. I’m a little burned out from working on this right now, so I’ll just assumes it really does work for now :) Anyway, I’ll keep my fingers crossed that the notification does fire next time a real IPN comes through. I’ll keep you posted. Thanks a lot for your help! |
|
Posted: Wednesday Jun 13th, 2012 at 5:00 am #16349 | |
|
|
Great! Thanks for the update. Let us know how it goes. :) |
|
Posted: Saturday Jun 16th, 2012 at 10:22 pm #16698 | |
|
|
Hopefully this will be the last update on this. Things were still not working because the “custom” POST variable was not being properly replaced by the new domain. This is the code I was using:
For some unknown reason, this was not working. So I decided to simply replace it by:
And now everything seems to work at last! |
|
Posted: Tuesday Jun 19th, 2012 at 3:00 am #16829 | |
|
|
Great! :D |
This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.