Hi,
I am trying to setup PayPal Pro UK Hosted Iframe Solution, the html works, but I am unable to understand as to how to get the IPN notification, can anyone please help me ? The paypal documentation is not of much help regarding the IPN…my code is following:
[code]
[/code]The iframe comes fine but after successful or failed payment the IPN is not getting any hit etc. How IPN works in hosted solution re paypal ??? I have the following code for IPN:
[code]<?php
$req = ‘cmd=_notify-validate’;
foreach ($_POST as $key => $value)
{
$value = urlencode(stripslashes($value));
$req .= “&$key=$value”;
}
$header = “POST /cgi-bin/webscr HTTP/1.1\r\n”;
$header .= “Content-Type: application/x-www-form-urlencoded\r\n”;
$header .= “Host: www.paypal.com\r\n”;
$header .= “Connection: close\r\n”;
$header .= "Content-Length: " . strlen($req) . “\r\n\r\n”;
$fp = fsockopen (‘ssl://www.paypal.com’, 443, $errno, $errstr, 30);
// assign posted variables to local variables
$custom = $_POST[‘custom’];
$item_name = $_POST[‘item_name’];
$item_number = $_POST[‘item_number’];
$payment_status = $_POST[‘payment_status’];
$payment_amount = $_POST[‘mc_gross’];
$payment_currency = $_POST[‘mc_currency’];
$txn_id = $_POST[‘txn_id’];
$receiver_email = $_POST[‘receiver_email’];
$payer_email = $_POST[‘payer_email’];
if (!$fp)
{
// HTTP ERROR
}
else
{
fputs ($fp, $header . $req);
while (!feof($fp))
{
$res = fgets ($fp, 1024);
$res = trim($res); //NEW & IMPORTANT
if (strcmp ($res, "VERIFIED") == 0)
{
echo "Success";
exit();
}
else if (strcmp ($res, "INVALID") == 0)
{
echo "Sorry";
exit();
}
}
fclose ($fp);
}
?>[/code]
Please help.
Thanks.