IPN Notifications posting to wrong URL

JZarr
New Community Member

I have a website that was just recently redesigned, and the Notification URL for my IPN messages changed.  I have updated the Notifcation URL in the IPN preferences, but it only seems to work some of the time.  This morning I had 14 IPN notifactions for skipped/failed payments.  7 were sent to the new (correct) URL and processed fine.  The other 7 were sent to the old (incorrect) URL and failed to process.  Would there be any reason that the notification URL would not be the same for all IPN messages?

Login to Me Too
1 REPLY 1

PayPal_RobG
PayPal Employee
PayPal Employee

Hi JZarr,

 

Yes; existing recurring payments for which you've specified the NOTIFYURL when the recurring payment was initially created, will continue to use the old URL.

In order to use the new URL, you would need to cancel the existing recurring payment(s) and re-create them.

 

Alternatively, if the old URL sits on a domain which still exists and which is still under your control, you could do something as follows (my example is for PHP as that's what I'm familiar with, but any language could do this);

 

  1. Create a file in the exact same location, with the exact same filename as your old IPN script
  2. Paste the following code and replace where indicated

 

<?php

 

// Force a successfull HTTP response to be returned to PayPal

header("HTTP/1.1 200 OK");


// Check if we've received POST data

if(!empty($_POST)) {

// Open a connection to www.yourdomain.tld on port 80

$fp = fsockopen("www.yourdomain.tld", 80, $errno, $errstr, 30);

 

// If your site use SSL, uncomment the line above and use this instead

// $fp = fsockopen("ssl://www.yourdomain.tld", 443, $errno, $errstr, 30);
if (!$fp) {

// Return an error if you're unable to set up a connection

echo "$errstr ($errno)<br />\n";

} else {

// Build the HTTP data

// Replace "youroldIPNscript.php" by the filename of your old IPN script

// For example, if your IPN script is available on www.yourdomain.tld/checkout/paypal/ipn.php

// Then you the line below would read "POST /checkout/paypal/ipn.php
$out = "POST /youroldIPNscript.php HTTP/1.0\r\n";

// Replace by your (old) domain name again

$out .= "Host: www.yourdomain.tld\r\n";
$out .= 'Content-Type: application/x-www-form-urlencoded\r\n';
$out .= 'Content-Length: ' . strlen($data) . '\r\n\r\n';
$out .= "Connection: Close\r\n\r\n";
// Send the HTTP data

fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}

// Close the connection
fclose($fp);
}

}

?>

 

What this script does, is that it 'forwards' all incoming POST data arriving on your old IPN script URL automatically to your new IPN script URL.

That way, your new IPN script will always receive the IPN data, even if it was sent to the old URL.

I agree it's a bit of a workaroud, but at least you'll be able to receive your IPN data again.

 

Hope this was useful. Unfortunately I don't have an example in any other languages, but if you are (or have) a developer, they should be able to create a similar file for you fairly quickly.

 

-Rob

----
For technical assistance with PayPal merchant product offerings, please file a ticket at https://www.paypal.com/mts/
Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.