I am trying to make an PHP app, that will interact with MySQL. I already have an page that gets POST data, and after it gets it, it gives "credit" to user. Can PayPal button after successful order send me an post data? or is there any other way? (most likely simplier and more secure)
Yes, have a look at PayPal Instant Payment Notification (IPN) - https://www.paypal.com/ipn/
This will force a POST of transactional data to be sent to you whenever a transaction has been initiated. If you currently use Website Payments Standard (HTML based buttons), you can simply add
<input type="hidden" name="notify_url" value="http://full-URL-to-the-script-you-set-up-for-IPN">
You'll need to take all POST data you received from PayPal, append cmd=_notify-validate and send it back to https://www.paypal.com/cgi-bin/webscr (or https://www.sandbox.paypal.com/cgi-bin/webscr for Sandbox) in order to validate the IPN message.
Depending on this result, you'll get back an INVALID or VERIFIED response.
INVALID may mean the IPN POST didn't originate from PayPal, whereas VERIFIED means the IPN POST was verified as indeed coming from PayPal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With