I would like to have a text input form with a submit button that goes to paypal, upon payment the contents of the form should go in a mysql database..
This sounds trivial, but I'm having such a hard time with paypal's IPN.
Can anyone point in me in the right direction?
Thanks!
Step 1: In your PayPal Account, go to my account –> profile – my setting tools – instant payment notifications – update – choose IPN settings. Step 2: Paste the notification URL given and enable the option “* Recive IPN messages”.
APICurrent. Instant Payment Notification (IPN) is a message service that notifies you of events related to PayPal transactions. You can use IPN messages to automate back-office and administrative functions, such as fulfilling orders, tracking customers, or providing status and other transaction-related information.
View IPN messages and details. Use the IPN History page on the PayPal website to view IPN messages sent to your listener URL from PayPal, and to request that messages be resent. Select the IPN messages to review. You can specify a date range, delivery status, and PayPal transaction ID.
The International Performer Number (IPN) is a unique universal identifier allocated to every single PPL-registered performer as well as performers registered with other collective management organisations (CMOs). This ID number is used to identify a performer in exchanges with other CMOs around the world.
PayPal has some sample code on their website. However the bigger problem you'll face is that the user will probably want a real-time response. This is usually done by processing the PDT data that is submitted to your site when the user clicks the link to return to your site. At some point later PayPal will post to your IPN url similar data. You need to avoid processing the data twice.
Also the data in question is only PayPal's data about the transaction. It does not contain arbitrary data. You should probably record the customer's order before sending them to paypal, or else look for a pass-through variable. For example, when creating a billing agreement, there is a variable called custom
which is passed back to you as you created it. You can store an order id or whatever you want in that variable. Be careful to validate its contents to make sure it's still correct for the transaction details.
You don't, and can't, get the entire contents of the form back from Paypal. What you will get is a postback to the address you sent in the "return" field. The best way to pass arbitrary information through the process from your form to the postback is in the "item_number" field (preferably by using it as an ID in your database linked to whatever information you want to track).
I know this question was already answered years ago, but for those who stumble upon it in the future...
I found this class + example to be particularly useful, so much so that I've re-used it for countless projects: http://www.micahcarrick.com/php-paypal-ipn-integration-class.html
Update: The page is offline now, but there's an archived version here which still has a working download link: https://web.archive.org/web/20140210202247/http://www.micahcarrick.com/php-paypal-ipn-integration-class.html
And here's a direct link to the archived download: https://web.archive.org/web/20140210202247/http://www.micahcarrick.com/files/paypal-1.3.0.zip
From the archived page, the author also links to a new version of his library, which is probably the better option now: https://github.com/Quixotix/PHP-PayPal-IPN
This PHP sample should help you get started with IPN.
Here you can find the PHP API for PayPal, which might be useful even though it doesn't include sample that deals with IPN.
You will find some examples of IPN Script if you follow this link
https://paypaltech.com/SG2/
Just select your programming language and the type of script that you are loonking for.
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