1. Computing

Discuss in my forum

How to Create a Simple Shopping Cart with PayPal

The Easy Way and the Better Way

By

Paypal Buy Now Button

Paypal Buy Now Button

Image courtesy Paypal (http://www.paypal.com)

Paypal makes it very easy to create a shopping cart on your website. I will show you two ways to do it, first the easy way and then the more secure (but really not that hard either) way. Paypal makes money by charging a small percentage of the purchase price. They deduct that automatically from the payment, so that's easy as well. The only caveat is that if your monthly sales are more than $3000 US you have to apply for a merchant account. After your merchant account is approved, the rates drop the more you sell.

But first, there is some information you need to know in order to set up your Paypal store:

Paypal Shopping Cart Requirements

  • A Paypal account
    If you don't have a Paypal account, go to Paypal and sign up for one. Use an email address you want associated with your shopping cart. The best is to use an address that is on the domain of your website, but it's not required.
  • Something to sell
    You'll need to know the item's name, price, and optionally shipping costs and tax rate.
  • A website
    This can be any website at all, from a personal page to a specialized domain
  • An HTML editor
    So that you can add your shopping cart to the page

The Easy Way to Set Up a Paypal Shopping Cart

The easiest way to set up a Paypal shopping cart is to copy the HTML following code where you want the "Buy Now" button.

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
 <input type="hidden" name="cmd" value="_xclick">
 <input type="hidden" name="business" value="PAYPAL EMAIL ADDRESS">
 <input type="hidden" name="lc" value="US">
 <input type="hidden" name="item_name" value="ITEM FOR SALE">
 <input type="hidden" name="amount" value="PRICE">
 <input type="hidden" name="currency_code" value="USD">
 <input type="hidden" name="button_subtype" value="products">
 <input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
 <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif"
 border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
 <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
 </form> 

Change the three bold items to your values, specifically:

  • PAYPAL EMAIL ADDRESS - the address you receive paypal funds from
  • ITEM FOR SALE - a short description or title of the item for sale
  • PRICE - Do not include the dollar-sign, and do include the pennies, even if it's an even number (ie. 800.00 - not $800) The price will be in US dollars.

You can put that form on every page that you want to sell something, just change the price and description

The Better Way to Set Up a Paypal Shopping Cart

While it's very easy to put the above code anywhere you want to sell something, there are some problems with doing it that way:

  • Your Paypal email address is written in clear text in your HTML - wide open for spammers to harvest
  • It is just one button, "Buy Now", there are no other options
  • You don't have any options for price and options on what you're selling
  • And lots of other options

To solve this, you should go to Paypay directly. They have a button designer you can use to

For security reasons, I don't recommend clicking on any link directly into Paypal, even if you trust the source. Instead, you should type in http://www.paypal.com into your browser window, and navigate to the button designer directly:

  1. Go to http://www.paypal.com/
  2. Mouse over the "Get Paid" option in the menu and then click on "Accept Credit Cards"
  3. Click on the "Setting Up" tab
  4. Click on "set up your button"

Once you're in the button builder you can customize lots of options on your form, including:

  • Change it to an "add to cart" button so that customers can shop for multiple items
  • Accept donations, set up subscriptions, or sell gift certificates
  • Use item IDs to have Paypal help you with your inventory (with a Paypal business account)
  • Change currencies or set up multiple prices (for different sizes or options)
  • Add in shipping fees and taxes
  • Most importantly have Paypal use a Merchant ID for your transactions, so your email address is secure.
  • Customize checkout pages (with a Paypal business account)
  • And lots of other options

Once you're done choosing your options, click on the "Save Changes" button. Then just paste the code that is generated into your HTML editor where you want the button.

  1. About.com
  2. Computing
  3. Web Design / HTML
  4. Web Strategy
  5. Ecommerce
  6. How to Create a Simple Shopping Cart with PayPal

©2014 About.com. All rights reserved.