Reputation: 4665
I have made a membership system which uses paypal subscription of $9.9/month. In ipn.php I can handle if user paid or failed on the first time.
<?php
ini_set('log_errors', true);
ini_set('error_log', dirname(__FILE__).'/ipn_errors.log');
include('ipnlistener.php');
$listener = new IpnListener();
$listener->use_sandbox = true;
try {
$listener->requirePostMethod();
$verified = $listener->processIpn();
} catch (Exception $e) {
error_log($e->getMessage());
exit(0);
}
if ($verified) {
// he paid
} else {
// he didn't pay
}
?>
However, I don't what if user won't pay his subscription next month. Which method should I consider on to detect this ?
Upvotes: 2
Views: 279
Reputation: 311008
It's not as simple as 'verified => he paid'. Not by a long chalk. There are several different transaction types. You have to look, and interpret. One of them is cancellation, another is EOT (end of term), etc.
For example, in this case if you don't get the subscr_payment IPN next month, don't renew the subscription.
Upvotes: 1