At the moment, I have PHP code which allows user1 to pay user2. If user2 logs into his/her paypal account s/he will see a refund
button next to the transaction for 60 days.
If user2 clicks the refund
button, is it possible for my PHP code to capture and/or receive details about this refund event, even though all this is happening directly from the paypal site?
I'm guessing this is not possible, but am posting this question with the thought that I could be wrong as I don't know paypal's api's like the back of my hand.
add the location of your IPN listener to your account settings. This way, all notifications will be sent to your listener regardless of whether it initiates from your code. At paypal.com, specify the Notification URL to your IPN listener in the Profile > My Selling Tools section of your PayPal Business or Premier account.
https://www.x.com/developers/paypal/documentation-tools/ipn/ht_ipn https://cms.paypal.com/cms_content/ES/es_ES/files/developer/IPNGuide.pdf
You should be able to achieve this by setting up a listener on your website for paypal IPN.