My IPN code used to work - but no longer. What changed?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This IPN handshake code used to work just fine. Now it doesn't. My code didn't change. What did? I have truncated the complete php module past the handshake, because it doesn't get that far anymore.
<?php
$req = 'cmd=_notify-validate';
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}
$environment = 'Live';
$header = "POST /cgi-bin/webscr HTTP/1.1\r\nHost: ipnpb.paypal.com:443\r\n";
$fp = fsockopen('ssl://ipnpb.paypal.com', 443, $errno, $errstr, 30);
$header .= "Content-Type: application/x-www-form-urlencoded\r\nContent-Length: ";
$header .= strlen($req) . "\r\n\r\n";
$today = $_POST['payment_date'];
$lastname = $_POST['last_name'];
$amount = $_POST['payment_gross'];
$currency = $_POST['mc_currency'];
$fee = $_POST['mc_fee'];
$firstname = $_POST['first_name'];
$donoremail = $_POST['receiver_email'];
$invoice = $_POST['invoice'];
$custom = $_POST['custom'];
if (!$fp) {
$ipn_verified = false;
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp (trim($res), "VERIFIED") == 0) {
$ipn_verified = true;
break;
} else if (strcmp (trim($res), "INVALID") == 0) {
$ipn_verified = false;
break;
}
}
}
fclose ($fp);
- Labels:
-
Legacy APIs

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- phone verification problem in PayPal Reporting
- Selected Shipping Method amount not updating to cart for card payment in SDKs
- changing prices on paypal buttons in PayPal Payments Standard
- PayPal Express Error #10413 when people use a discount code on my Magento2 store in PayPal Payments Standard
- Cannot delete this Sandbox account. Failed to close account. Debug ID: 14e9be05fe202. in Sandbox Environment