Hello,
When I use the PayPal button for a payment, I get the data in my database.
When I use exact the same script, but with E-junkie, the data doesn't get inserted into my DB.
My IPN script is:
<?php
//Change these with your information
$paypalmode = ''; //Sandbox for testing or empty ''
$dbusername = 'removed'; //db username
$dbpassword = 'removed'; //db password
$dbhost = 'removed'; //db host
$dbname = 'removed'; //db name
if($_POST)
{
if($paypalmode=='sandbox')
{
$paypalmode = '.sandbox';
}
$req = 'cmd=' . urlencode('_notify-validate');
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= "&$key=$value";
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www'.$paypalmode.'.paypal.com/cgi-bin/webscr');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Host: www'.$paypalmode.'.sandbox.paypal.com'));
$res = curl_exec($ch);
curl_close($ch);
if (strcmp ($res, "VERIFIED") == 0)
{
$transaction_id = $POST['txnid'];
$payerid = $POST['payerid'];
$firstname = $POST['firstname'];
$lastname = $POST['lastname'];
$payeremail = $POST['payeremail'];
$paymentdate = $POST['paymentdate'];
$paymentstatus = $POST['paymentstatus'];
$mdate= date('Y-m-d h:i:s',strtotime($paymentdate));
$otherstuff = json_encode($_POST);
$conn = mysql_connect($dbhost,$dbusername,$dbpassword);
if (!$conn)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db($dbname, $conn);
// insert in our IPN record table
$query = "INSERT INTO apple
(transactie_id,koper_id,naam,email,transactie_datum,betalings_status,ieverything_else)
VALUES
('$transaction_id','$payerid','$firstname $lastname','$payeremail','$mdate', '$paymentstatus','$otherstuff')";
if(!mysql_query($query))
{
//mysql error..!
}
mysql_close($conn);
}
}
?>
Can somebody please help me, I get a lot of disputes and claims now