I am trying to receive IPN from paypal. I got a php script from paypal support but although the ipn history says that the information was sent, nothing happens on my side. How can I test to see if my file is even being executed?
Can I do a print_r() to check if the post variables that paypal sends are loaded? I'm doing something like this:
use Folder\Namespace;
require_once 'Folder\Namespace.php';
$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'];
print "<script type=\"text/javascript\">";
print "alert('Thank you!')";
print "</script>";
$arrIpnData[]=$item_name;
$arrIpnData[]=$item_number;
$arrIpnData[]=$payment_status;
$arrIpnData[]=$payment_amount;
$arrIpnData[]=$payment_currency;
$arrIpnData[]=$txn_id;
$arrIpnData[]=$receiver_email;
$arrIpnData[]=$payer_email;
$ipnReturn=new SomeClass($arrIpnData);
I don't want to paste the entire code that I got from paypal unless someone thinks it is necessary.
Don't know where to start debugging because I get no indication of information being transferred from paypal.
I've turned on Notification URL http://www.example.com/pPalipn.php. What could I be doing wrong?
Thanks for any help!
The most simple solution would be dumping the contents of the $_REQUEST
(i.e. combination of GET and POST) variable to a log file:
file_put_contents('/tmp/paypaltest.log', print_r($_REQUEST, true), FILE_APPEND);
Going from there, you can narrow down the parts to be logged, or write other parts to the log file.
If the log file stays empty, then it might be that PayPal cannot connect your server. This may be because your dev server is on a local machine or behind a firewall. In this case you must obviously make it available from the outside, under the domain name you're referencing it.