how to test paypal IPN locally or on sandbox in

Posted on 2011-10-02
Last Modified: 2012-08-13
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.
Question by:mmalik15
    1 Comment
    LVL 18

    Accepted Solution

    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now