I use Quixotix-PHP-PayPal-IPN Class, to get payments in my site.
The problem is that i always get INVALID from paypal, the code that i did is:
try {
$verified = $listener->processIpn();
} catch (Exception $e) {
file_put_contents('ipn_log.txt', $e);
exit(0);
}
if ($verified) {
file_put_contents('ipn_log.txt', 'success');
if (strcasecmp($_POST['receiver_email'],$paymail) == 0 && $_POST['payment_status'] == 'Completed' && $_POST['mc_currency'] == 'USD') {
$stmt = $db->prepare('SELECT msg FROM prices WHERE price = ?') or die($db->error);
$char = 'd';
$stmt->bind_param($char, $_POST['payment_gross']);
$stmt->execute() or die($db->error);
$stmt->store_result();
if ($stmt->num_rows > 0) {
$stmt->bind_result($msg);
$stmt->fetch();
$stmt->close();
$stmt = $db->prepare('UPDATE users SET pack = (pack + ?), transid = ? WHERE id = ? AND transid != ?') or die($db->error);
$txn_id = $_POST['txn_id'];
$custom = $_POST['custom'];
$stmt->bind_param('isis', $msg , $txn_id , $custom, $txn_id);
$stmt->execute() or die($stmt->error);
}
}
}
else file_put_contents('ipn_log.txt', 'not verifed');
So i do a payment for checking, but the file 'ipn_log.txt' always contain: 'not verifed'
any ideas?
The problem is probably that the library hasn't been updated in a long time. There are many forks of it, that have been updated.
I also have a fork of it, fixed, and myself and others have used it in production: WadeShuler/PHP-PayPal-IPN
Switch to it, and see if that helps you. Please read the README and take a look at the example.