Shinichi
Shinichi

Reputation: 505

How to detect via IPN when user request refund from Paypal

I code a website (PHP) that allow user add fund via Paypal. I use IPN to get result and insert data into database. That 's step is okay.

However I wonder if a user login to Paypal and refund, I don't know how to detect that action occurs. Does any method return from Paypal via IPN that alert me when refund ?

Thanks so much !

Upvotes: 1

Views: 1408

Answers (1)

Matt Borja
Matt Borja

Reputation: 1587

See https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_admin_IPNReference#id091EB04C0HS

Under Payment Information Variables, see the description for mc_fee and mc_gross:

mc_fee: Transaction fee associated with the payment. mc_gross minus mc_fee equals the amount deposited into the receiver_email account. Equivalent to payment_fee for USD payments. If this amount is negative, it signifies a refund or reversal, and either of those payment statuses can be for the full or partial amount of the original transaction fee.

mc_gross: Full amount of the customer's payment, before transaction fee is subtracted. Equivalent to payment_gross for USD payments. If this amount is negative, it signifies a refund or reversal, and either of those payment statuses can be for the full or partial amount of the original transaction.

Same goes for payment_fee, etc. Just use that IPN Variable Reference page and do a search for "refund" to see which variables you want to evaluate in your own code.

Upvotes: 2

Related Questions