I'm using a PayPal IPN script to process subscription payments on my new project. Everything seems to work great but for some reason when the payment is processed and accepted my databases just don't update.
This is the part of the IPN script to update my databases:
$p->add_field('cmd','_xclick-subscriptions');
$p->add_field('no_note','1');
$p->add_field('currency_code','USD');
$p->add_field('a3', "0.01");
$p->add_field('t3', "M");
$p->add_field('p3', "1");
$p->add_field('src', "1");
$p->add_field('sra', "1");
$p->add_field('business', "myemail@gmail.com");
$p->add_field('return', "http://myurl.com/");
$p->add_field('cancel_return', $this_script.'?action=cancel');
$p->add_field('notify_url', $this_script.'?action=ipn');
$p->add_field('item_name', "My Package Thing ($_POST[hash])");
$p->add_field('custom', "$_POST[hash]");
$p->submit_paypal_post();
//$p->dump_fields();
break;
case 'success':
echo "<html><head><title>Success</title></head><body><h3>Thank you for your order.</h3>";
echo "</body></html>";
break;
case 'cancel':
echo "<html><head><title>Canceled</title></head><body><h3>The order was canceled.</h3>";
echo "</body></html>";
break;
case 'ipn':
if ($p->validate_ipn()) {
include("config.php");
$select = mysql_query("UPDATE `mydb_accounts`.`accounts` SET `active` = '1' WHERE `accounts`.`hash` = '$_POST[hash]';") or die(mysql_error());
mysql_query($select);
} break; }
$_POST[hash]
works fine because when the "PayPal Payment Page" appears it's shown the item description.
Any thoughts? Thanks!