问题
Will this script below work with the IPN Messages Sent with IPNs if the member is on a subscription and/or pay once payment and they request a Refund, Reversal, or Partial Refund?
if($payment_status == "Refunded" || $payment_status == "Reversed" || $payment_status == "Partially Refunded"){
mysql_query("UPDATE members SET month_date = '$gettoday', subscr_id = '$subscr_id', subscr_cancel = 'Y', active = 'N', prepay = 'N' WHERE id='$id'");
}
If not, what can I use or how do I script it in PHP to make my system read the IPN payment_status of all and know what subscriber (by their PayPal Subscribe ID or Member ID in my system) or payer ((By their Member ID in my system) to perform actions on when one of these are sent?
Also, If I wanted to check for a subscribe ID will it be smarter to do it like this?
if($payment_status == "Refunded" || $payment_status == "Reversed" || $payment_status == "Partially Refunded"){
if($subscr_id){
mysql_query("UPDATE members SET month_date = '$gettoday', subscr_id = '$subscr_id', subscr_cancel = 'Y', active = 'N', prepay = 'N' WHERE id='$id'");
} else {
mysql_query("UPDATE members SET month_date = '$gettoday', subscr_cancel = 'Y', active = 'N', prepay = 'N' WHERE id='$id'");
}}
回答1:
Paypal will first send an IPN that the payment status is reversed, followed by another IPN with the status refunded. So, I would not include both reversed and refunded as you did in your original example.
As for testing for the user_id, that's always consistent, every IPN includes the payers paypal email including the reversed/refunded messages.
来源:https://stackoverflow.com/questions/5174997/help-with-payment-status-paypal-refunded-reversed-partially-refuned-ipns