Vítejte na blog.vyvojar.cz Přihlásit | Registrovat | Pomoc

PayPal library

If you need to integrate PayPal into your WebSite, you may encounter several small problems starting from choosing the right Payment service, through finding the right library and ending with testing payments. Here are some useful links, which I gathered over a period of time when I developed a payment service.

  1. On PayPal WebSite, you can find some Payment services comparison. There is a Recommendation wizard which you can start with.
  2. After that you'll need some documentation about PayPal protocols. The documentation is placed at a Developer central, where you can find many useful information. Along with the documentation it is good to use some existing library. Some libraries you can find on PayPal SDKs page. I compiled a library named com.paypal.wps, see later in this article.
  3. Next you will need some testing account. For this purpose PayPal provides a Testing SandBox - PayPal. Its a copy of real server and to access the testing environment you need to register with your email to this sandbox. The registration email is not your testing account! The email only allows you to enter the PayPal Sandbox where you can create as many testing account as you need.

For our needs we choose to implement Website Payment Standard, which uses a HTML form to communicate with PayPal server. The form must contain some HTML variables, which are described in the Website Payments Standard Integration Guide, which is accesible on the documentation page introduced earlier.

ASP.NET and PayPal Forms Problem

Here you will probably encounter a problem with HTML forms, because PayPal requires a form with action attribute set to PayPal server, however in ASP.NET 4.0 the Page still could contain only one HTML form, So you cannot include two forms (one for ASP.NET and one for PayPal) on the same page. Fortunately there was many articles written about this topic and I found very useful article How to Integrate Both Google Checkout and PayPal In 3 Steps which offers simple solution using Button.PostBackUrl Property which is new in .NET 2.0. These guys found that PayPal server accepts the form which is redirected using this property:

<asp:imagebutton id="btnSubmitPaypal" runat="server" imageurl="/images/checkout-paypal.gif" alternatetext="Purchase Using Paypal" postbackurl="https://www.paypal.com/us/cgi-bin/webscr" />

If you develop in some older .NET frameworks, try solution with nested MasterPages.

Website Payments Library Toolkit for .NET

PayPal allows developers to download Website Payments Standard Toolkit (WPST). However this toolkit was written by some java developer, who didn't know ASP.NET programming environment. I think the object oriented part of the code is written very well, but the web forms part is very bad. The author of the toolik integrates classes into WebApplication so it is not feasible to use the code directly in your own application. So I split the web application and I compiled the classes with the VS.NET 2005 into the library called com.paypal.wps. I adhere to the naming convention of the author and I didn't change the code at all, except a small change in calling CAPICOM component

You can find the solution in attached zip file.


Zveřejněno 15. června 2009 10:59 by ernest
Vedeno pod: ,

Attachment(s): PP_AspNet_WPS_Toolkit.zip

Upozornění na nové komentáře

Pokud chčeš dostávat upozornění emailem na změny u toho příspěvku,tak se zaregistruj zde.zde

Odebírat komentáře k tomuto příspěvku pomocí RSS

Komentář

# re: PayPal library

thanks for info, i will use this information when i will go to implement such payment processing to my framework.

15. června 2009 15:33 by terrorix

Vytvoření nového komentáře

(povinný) 
povinný 
(povinný) 
Opiš čísla, která vidíš na obrázku: