how to test paypal IPN locally or on sandbox in

Once a user fills in registration form  clicks the register button i want to store the user info in the database with user status as inactive which will become active once i get IPN verification status from paypal. I m using BuyNow button. Its my first paypal integration. My first question is, if this model is okay i.e. keeping details in the database until IPN verfiication. Secondly how can i test it on sandbox or locally.  As we have to specify a return URL to recieve IPN notfication

I m struggling with the paypal integration and will greatly appreciate any help.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gary DavisDir Internet SvcsCommented:
Your idea of creating a record prior to completed payment is OK, especially if there is specific information needed that you would not received in the IPN message. You will wind up with unpaid records in the table, of course but you can deal with that as needed.

PayPal does have an IPN tester which will send an IPN to your url as long as it can get to it. If you are inside a firewall or require authentication to your server, it may not work. In that case, you will have to use your own test page to send to the IPN.

Normally, the IPN does not display anything to the Response but you can if you are testing - If PayPal receives content, it will ignore it. It is really only looking for an HTTP 200 response.

I also recommend your IPN log all incoming IPN messges as the first step - to the database or filesystem. The IPN is the ideal place to send emails to you or your customer as well as update the database. For safety, you may want to enclose the entire code within a try/catch and the traps should be logged/emailed.

The PayPal sandbox can be used for testing. The IPN will receive a test-ipn flag you can use in the IPN code to affect processing (like flag the registered user as a test-user or whatever).

Gary Davis

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.