PayPal IPN ASP.NET 2.0 C# Class

11. April 2008

UPDATE: 08-08-2009

This paypal ipn class will build in an ASP.NET 3.5 project as well. 

Hey everyone I put up a C# class to use with PayPal's IPN feature.  We all know there isn't that much great documentation on how to efficiently use PayPal's IPN feature.  However, I do use the class on our own website.  And I also know that it doesn't pull every field, but it does account for alot of them that you would need....hence why I am putting the class out there so you can modify the code for your needs!  I hope the class is simple enough, but if not I am always up for suggestions. Below is a code sample of what we put in our page load that handles the IPN post back:

 PPIPN objPP = new PPIPN("LIVE");
//PPIPN objPP = new PPIPN("TEST");
//PPIPN objPP = new PPIPN("ELITE");

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();

That's about it..the class handles everything else including emailing you details!

Word of caution..it's best to disable the email functions when using the SandBox environment since they are bogus emails anyway. 

This is available on codeplex with some more details about variables as well:

http://paypalipnclass.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=31282

Hopefully this makes your PayPal IPN experience a bit easier in ASP.NET.  Oh yea...this is meant for ASP.NET 2.0!

 

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

ASP.NET ,

Comments

4/24/2008 3:30:35 AM #
Guys,

Thank you for this code, I'm looking forward to trying it out. Quick question: could you offer some detail on your comments on disabling email? What would be your suggestion on how to test the email functionality?

Rgds,
Anthony Grace Smile
Janrah
11/21/2009 2:38:08 AM #
Hi, I'm trying to implement this code you have posted on site becuase I am trying to integrate paypal on my site using asp.net. when I pasted your code on my site is said PPIPN is a namespace not decalred. I really need if anyone can help me. I don't know what to do anymore.

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading