I am try开发者_StackOverflow社区ing to integrate Paypal with one of the registration forms in my site. The flow is like this:
- The user visits the registration page and fills out his details, like first name, last name, username, password, age, etc.
- Then on clicking submit button, he navigates to the paypal site, pays some amount like 5$ and after successful payment, returns back to my site.
- The registration is not yet complete. I want to check whether the payment is successful or not, and if it is successful, then i have to insert the user data (filled prior to submitting the registration form) into the database.
Now my question is, how can i keep track of user data filled in the form and sent to paypal? What is my best bet?
- Should i use any custom hidden fields in the form to store these form values, and if so, is there any size limit?
- Should i store the entire form data in a session, and after succesful payment, use this session data to insert into db?
Or is there any other way of doing it?
I just want to get back all the form values after a successful payment, and only then, i can insert them into the database. I prefer sandbox testing prior to using real paypal.
I suggest making a registration without instant payment, but making their account inactive. This way you will get user id and put it in the custom field. Uppon a successful payment, activate user's account. Here is an example of the IPN script. https://cms.paypal.com/cms_content/US/en_US/files/developer/IPN_PHP_41.txt
You will need a business account for this to work.
精彩评论