tags:

views:

2829

answers:

6

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!

+4  A: 

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).

chaos
+4  A: 

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 mp_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.

Mr. Shiny and New
A: 

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.

Sire
A: 

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.

Jazz009
The site just gives me 'coming soon' when I select C#
Gordon Tucker
A: 

Am guessing what you want is to make a form that when the user clicks the submit button is taken to paypal and then back to your site where you can get YOUR form's content?

I haven't see people do this, what I've seen people do is that when the user submits the form they are taken to a script to process the form and in that script they are redirected to paypal which is where they pay, you can then use IPN to process paypal's response.

SoftwareDev
A: 

I've made a tutorial at

http://learnbysoft.blogspot.com/2010/09/paypal-ipn-google-app-engine-python.html

It is for PayPal IPN and Google App Engine(python).

george

george kyaw naing