E-Commerce Made E-Z

MultiValue applications fill many niches, but most of them are ultimately involved in some way with the buying or selling of goods or services. In the pre-Internet and early-Internet days, collecting or sending the funds to finalize these financial transactions was done manually, “off line” and outside of the application. This may have originally involved wire transfers or checks, though many businesses eventually added support for credit card payments, either via manual card readers or various third party payment processors.

In today’s Internet-connected world, however, as our applications are migrating from the green-screen desktop to the rich browser on the web, the need for customized payment transaction software has been reduced or eliminated, as several large vendors have provided open connectivity that any web application can use. Google and Amazon are two of the big names, but the five-hundred-pound gorilla of payment processing has to be PayPal. PayPal was the strongest of several financial transaction companies in the early 2000s, but it really rose to preeminence after it was acquired by eBay. Today, PayPal handles over 15% of US e-commerce transactions, and nearly 10% of e-commerce transactions world-wide.

Over a year ago, PayPal opened up its APIs so that other software could take advantage of its peer-to-peer network. While several sets of APIs allow the payment transactions to be handled “behind the scenes” by PayPal, while leaving the user interface to the individual application, another set — the Website Payments Standard — is the simplest solution to use. By providing a set of simple, standardized calls, any application can now offload the details of the transaction, and users (many of whom may already have PayPal accounts) can interact with a standard, familiar payment interface.

In order to accept PayPal payments, you must sign up for a “business” account; go to http://www.paypal.com for more information. Note that once your business account is established, you can specify a number of convenient defaults for order processing (including whether your customers must be PayPal customers themselves, or whether the processing should be “PayPal optional”; whether you want shipping costs calculated automatically, or passed in with each transaction; and many others).

Once you have established your PayPal business account, you will be issued a PayPal business ID; you can use either this value, or the email address you specified for your PayPal account, when interacting with the Website Payments Standard.

Website Payments Standard includes three types of interaction: Buy It Now, Add To Cart, and View Cart. Buy It Now is used to add a single item to PayPal’s “shopping cart” and begin the checkout process; Add To Cart can add a single product or service to the shopping cart, but then allows you to continue shopping; and View Cart displays the current items in the cart and can start the checkout process. PayPal can make these actions available even to non-programmers, letting you create custom buttons on the PayPal website that embed many of the required details, and which you can then place directly onto your web page. Fundamentally, though, each of these interactions is controlled by sending https:// web requests to PayPal, along with “name/value pairs” defining the details of the action, and it is by using these web requests that you have the most flexibility.

In OpenInsight’s web development tool, O4W, the details of invoking the PayPal functions have been hidden behind O4W’s own O4WPayPal routine, but developers in other environments can also code these directly. You must create an HTML form, or use an HTML IFRAME, to submit your request to https://www.paypal.com/cgi-bin/webscr, passing in the desired command (via the “cmd” variable) of “_cart” (for Add To Cart or View Cart), or “_xclick” (for Buy It Now).

The other name/value pairs that are required for Buy It Now processing include “business” (your PayPal ID), “currency_code” (for US processing, “USD”), “lc” (locale, “US” for US vendors), “item_name” (the name of the item to show up on the PayPal description), “amount” (the amount for the product or service), “item_number” (your product number), and “button_subtype” (“product” for a product, “service” for a service). You might also provide “quantity” (if not specified, defaults to “1”), “shipping” (any shipping cost), “tax_rate” (the tax percentage), and various demographic fields if you want them pre-filled on the PayPal checkout. You may also specify the URL you would like PayPal to return to after the transaction has been completed, via the “shopping_url” variable.

For example, the O4W PayPal request:

O4WPaypal(“BUY”, “buyitrtn”, “paypalmgr@revelation.com”, “sample buy it now item”, “sampbin001”, “”, “10.99”)

would generate the HTML in figure 1 and, when clicked, would generate the action in figure 2.

 

<form enctype="multipart/form-data" method="post" action="https://www.paypal.com/cgi-bin/webscr" name="o4wpostform">
   <input name="cmd" value="_xclick" type="hidden">
   <input name="business" value="paypalmgr@revelation.com" type="hidden">
   <input name="currency_code" value="USD" type="hidden">
   <input name="lc" value="US" type="hidden">
   <input name="item_name" value="sample buy it now item" type="hidden">
   <input name="amount" value="10.99" type="hidden">
   <input name="item_number" value="sampbin001" type="hidden">
   <input name="button_subtype" value="products" type="hidden">
   <input name="bn" value="PP-BuyNowBF:btn_buynowCC_SM.gif:NonHosted" type="hidden">
   <input name="return”
value="http://www.revelation.com/o4w/oecgi3.exe/O4W_ORDERFORM?O4WEvent=Paypal&amp;O4WControlBackup=buyitrtn" type="hidden">
</form>

Fig. 1

 

Fig 2

Fig. 2

 

The “Add To Cart” action supports the same name/value pairs as discussed above; the O4W PayPal request:

O4WPaypal(“ADD”, “addrtn”, “paypalmgr@revelation.com”, “sample item”, “samp001”, “”, “10.99”)

generates the HTML in figure 3 and, when clicked, generates the action in figure 4.

 

<form enctype="multipart/form-data" method="post" action="https://www.paypal.com/cgi-bin/webscr" name="o4wpostform">
   <input name="cmd" value="_cart" type="hidden">
   <input name="business" value="paypalmgr@revelation.com" type="hidden">
   <input name="currency_code" value="USD" type="hidden">
   <input name="lc" value="US" type="hidden">
   <input name="add" value="1" type="hidden">
   <input name="item_name" value="sample item" type="hidden">
   <input name="amount" value="10.99" type="hidden">
   <input name="button_subtype" value="products" type="hidden">
   <input name="bn" value="PP-ShopCartBF:btn_cart_SM.gif:NonHosted" type="hidden">
   <input name="item_number" value="samp001" type="hidden">
   <input name="shopping_url”
value="http://www.revelation.com/o4w/oecgi3.exe/O4W_ORDERFORM?O4WEvent=Paypal&amp;O4WControlBackup=addrtn" type="hidden">
</form>

Fig. 3

 

Fig 4

Fig. 4

 

Finally, the “View Cart” action accepts a subset of those name/value pairs, specifically “cmd” and “business”, and adds “display”, whose value should be set to “1”. The O4W View Cart PayPal request:

O4WPaypal(“CART”, “cartrtn”, “paypalmgr@revelation.com”)

generates the HTML in figure 5 and, after a few more items were added to the cart, the action in figure 6 was generated.

 

<form enctype="multipart/form-data" method="post" action="https://www.paypal.com/cgi-bin/webscr" name="o4wpostform">
   <input name="cmd" value="_cart" type="hidden">
   <input name="business" value="paypalmgr@revelation.com" type="hidden">
   <input name="display" value="1" type="hidden">
   <input name="shopping_url”
value="http://www.revelation.com/o4w/oecgi3.exe/O4W_ORDERFORM?O4WEvent=Paypal&amp;O4WControlBackup=cartrtn" type="hidden">
</form>


Fig. 5

 

Fig 6

Fig. 6

 

By using these three Website Payments Standard APIs, you can add the ability to immediately accept credit cards or cash from any customer without developing your own custom software solution. If the “bottom line” in your business is to keep a healthy bottom line, the ability to get paid quickly and easily has to be a top priority, and PayPal has made that the easy part of e-commerce.

Revelation Software

Located in WESTWOOD NJ.

View more articles

Featured:

Jan/Feb 2011

menu
menu