PayPal IPN Class Implementation

Nov 13, 2009 at 2:36 PM

Good morning John. I am pretty new to setting up a Web site with PayPal, and especially utilizing Instant Payment Notification. The IPN feature is actually a little overwhelming because it is so hard to test and analyze what is wrong. I am currently working on a Web application project for school using ASP.Net pages. I have created a small 4-5 page Web site with a registration form where a payment needs to be made. I chose to utilize PayPal as a payment method and I have set up everything on my end to test through the PayPal Sandbox. I have been searching for the past day or two for a solution on how to set up IPN with my site when I came across your download here. While I can read through much of the code provided in your download and understand a good chunk of it, I am still unsure of everything which still needs to be done to fully set up IPN with my site.

1. What do i need to do on the page where the actual payment is being initiated from on my site? Do I need to put more than a simple pay now button?

2. Which page am I submitting to PayPal as the IPN Handler URL? Will this be .../IPNProcess.aspx?

3. Besides the following lines in the IPNProcess.aspx.vb file, are there any other items which need to be changed/altered in order to test IPN in the PayPal Sandbox?

         Dim objPP As New PPIPN("ELITE")
        'Dim objPP As New PPIPN("LIVE")
        'Dim objPP As New PPIPN("TEST")

        objPP.FromEmail = "email@yourdomain.com"
        'email address your smtp server will accept
        objPP.FromEmailPassword = "yourpassword"
        'password for the email address above
        objPP.SmtpHost = "yourSMTPHost"
        objPP.SmtpPort = "SMTPHostPort"
        objPP.ToEmail = "youremailatPayPal@domain.com"
        'this needs to be your business/email you have registered with PayPal
        objPP.MakeHttpPost()
        objPP.CheckStatus()

Any other help/direction you might be able to provide to a PayPal newbie would be greatly appreciated. Thanks in advance for your time and assistance. All the work you have done with creating the download is extremely helpful. I look forward to hearing back from you soon.

Coordinator
Nov 16, 2009 at 5:45 PM

Hello, sorry for such the late response.  First let me answer your questions:

  • 1) You need to do one of the following so PayPal knows to hit your IPN:
  •     When creating your button make sure to add the IPN value in
  •     Otherwise, you can setup the IPN value as a global option in your PayPal account.
  • 2) You will need to submit the entire URL which would be something like http://www.yoururl.com/IPNProcess.aspx
  • 3) everything looks good


Now, I still think testing in general with PayPal is not easy in anyway. I know they have a sandbox, but because it's a sandbox it's contained with what it can access from a networking standpoint (i.e., external URL's). They way I test with PayPal is abit confusing, but I'll give it a shot for you.

  • upload a test site to my hosting company containing just the stuff needed for the IPN
  • I login to the sandbox with my developer account
  • I make sure my IPN is set to the external URL from step 1
  • I use my "customer" account within the sandbox
  • I proceed to complete an order


At this point it should be able to communicate now with the IPNProcess.aspx page from the hosting company.  

You can also use the IPN Test page they have as well in the sandbox.  However, even with that it still requires a URL of where the IPN handler is. Again, in my case the URL of the handler is in the test site on my hosting company.

It's always interesting testing with PayPal.

I really need to put a blog post up on how to do it.  Good luck and let me know if this didn't help or I'm unclear on a few things.