Hi guys How do i integrate paypal ipn with a virtual service? Example: I have a classified ad script made by me ,user goes to form to post his ad,then he clicks submit ,after that script will send him to paypal to pay for his ad...after payment paypal sends him back then if payment has been maid his ad info is posted to the database if not his ad will not be allowed to be posted. Anyone knows how to do that ? Can you tell us?
this is something i really need to learn also. without much knowledge of the ipn i do know that you can set a return url. so a very simple way of mamiing this work would be to: file1 adds data to mysql database (the ad info, contact, etc). file 1 sends user to payal. user pays at paypal and is sent to the return url return url = file2 file2 updates the data in the database to "approved" status on form submit. that seems the simplest way, but i do think there is a way to it from one script. i just dont know it.
The above solution is not secure as the user could go to the return URL without having paid. The IPN script sends a message to your server directly, which you respond to correctly and then it sends the payment status. Once you have this and confirm its marked as settled you then can update your db to make the advert live. You can find sample code for integrating to the IPN on PayPals website https://cms.paypal.com/cgi-bin/mark...nt_ID=developer/library_code_ipn_code_samples
yes there is a secure way. the way i pointed out IS NOT SECURE , sorry it was a possible work around if you could find a better way. the reply by AstarothSolutions is the correctand secure way to do it. if i was needing this right now i would look for a class that has this ipn wrapped up nice and neatly, search php classes .com for a good script.
The IPN method is fairly secure, better still if it is done under an SSL but is not 1000% secure. Using their webservice under an SSL is their most secure method rather than the IPN but for 99% of sites the IPN is fine.