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 ,

blog comments powered by Disqus