Paypal IPN Detect Refund, PHP -
i'm doing custom work on idev affiliate paypal ipn , trying set catch refunded items. have database work correct, can't seem if catch right.
any advise on should change to?
if($_request["payment_status"] == "refunded"||$testing==1) { $email = $_request["payer_email"]; $sid = $_request["subscr_id"]; $tid = $_request["txn_id"]; if (!$tid) { $tid='xxx'; } if ($testing==1) { echo "testing on"; $sid = "i-e5e34e0dtmus"; } $query = "select * idevaff_sales tid1='$tid'"; $result = mysql_query($query); if (!$result) { //echo $query; exit; mail('***@gmail.com',"1",$query); } $arr = mysql_fetch_array($result); $aid = $arr['id']; $query = "select * idevaff_affiliates tid1='$tid'"; $result = mysql_query($query); if ($result) { //echo $query; mail('***@gmail.com',"2","$query"); } $arr = mysql_fetch_array($result); $email = $arr['email']; $f_name = $arr['f_name']; mail($email,"affiliate message - refund has granted recent affiliate commission.","dear $f_name, \n\n message here refund" ); $query = "update idevaff_sales set approved=3 tracking='$sid'"; $result = mysql_query($query); if (!$result) { //echo $query; exit; mail('***@gmail.com',"3","$query"); } }
hudson
here ended using successfully:
if($_request["payment_status"] == "refunded" || $_request["payment_status"] == "reversed" || $testing==1) { /*do database work here*/ }
Comments
Post a Comment