Help with PayPal Pro Hosted Solution

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.

did you configure the IPN notification URL in your PayPal account? IPN runs independently from the payment.

Hi,

Yes I did’nt configure that. Its working now. Only 1 question, paypal says that I have to show the transaction status and #, how it is possible to do that ???

Thanks.

show that where?

I see that in my paypal account when I select the option of not showing the PayPal’s default confirmation page and opt to show my own, in which case I have to specify a url where the user is redirected instantly after successful payment. I will post a screenshot shortly.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.