Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PayPal POST data after successful payment

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)

like image 835
Riki137 Avatar asked Oct 12 '22 01:10

Riki137


1 Answers

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.

like image 168
Robert Avatar answered Oct 14 '22 04:10

Robert