How to Add Paypal to a Web Site

Use Paypal for Receiving Payments from Internet Customers

Add Paypal to a Web Site - Paypal
Add Paypal to a Web Site - Paypal
Paypal is a safe and secure way of receiving on-line payments from customers, and can be added to a web site with the minimum of time and effort.

In the current economic environment many people are suffering from the credit crunch. Anyone with a product to sell must, therefore, ensure that those products are available to as many potential customers as possible. One obvious tool is the Internet.

However, this raises a problem - payment. How can someone in the UK (for example) pay someone in the USA safely and securely? The answer is Paypal. Paypal enables a payment to be made across the Internet and can be added to a web site in just a matter of minutes.

Initial Requirements for Adding Paypal to a Web Site

The product seller will need a Paypal account to be set up before they can receive any payments. This may take several days (since part of the account confirmation process is to transfer a small amount of money from the user's bank account to their new Paypal account and back again). Once the Paypal account is up an running then it's time to add Paypal to the web site.

Adding Paypal to a Web Page

Adding Paypal to a web site is very simple. It is just a matter of adding a little HTML (HyperText Markup Language) to a web page:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<-- The details of the transaction will go here-->
<CENTER><input type="image" src="images/paypal.gif" name="submit"
alt="Make payments with PayPal - it's fast, free and secure!">
</CENTER></form>

This simple form will send a payment request to a customer's Paypal account. However, before that is possible the transaction details must be added to the form.

Product Seller Details for the Paypal Form

Paypal, of course, needs to be told who the payment is to made to (i.e. the product seller):

<input name="business" value="mark.bain@linuxtalk.co.uk">

Paypal must also be told that the information is coming from a custom built payment form:

<type="hidden" name="cmd" value="_cart">
<input name="upload" value="1">

And Paypal should be told which currency the payment is to be made in:

<input name="currency_code" value="GBP">

The currency input is optional and if it is left out then Paypal will process the Payment is US Dollars.

Product Details for the Paypal Form

The whole point of this process is to sell a product on-line. Paypal, therefore, needs to be told about the product (or products) to be paid for:

Payment for My Product: £2.50
<input name=item_name_1 value="My product">
<input name=amount_1 value="2.50">

Here a single item is being sold, but more than one item can be included (in which case there would also be item_name_2 with amount_2, item_name_3 with amount_3 and so on). The number of each item being sold can also be defined:

<input name=quantity_1 value="2">

At this point all of the essential information for the payment transaction has been added to the form, and if the HTML code were to be added to a web page then it would be possible for a Paypal payment to be made. However there are some more factors to take into account- the customer details and the the handling and shipping costs.

Customer Details

Delivery details may not be required, or may be stored elsewhere, but if they are required then they must be included in the Paypal form:

<table>
<tr><td>First Name:</td><td><input name=first_name>
</td><td>Surname:</td><td><input name=last_name></td></tr>
<tr><td>Email:</td><td colspan=3><input name=email size=50></td></tr>
<tr><td>Address Line 1:</td><td colspan=3><input name=address1 size=50></td></tr>
<tr><td>Address Line 2:</td><td colspan=3><input name=address2 size=50></td></tr>
<tr><td>City:</td><td colspan=3><input name=city size=50></td></tr>
<tr><td>State/County</td><td colspan=3><input name=state size=50></td></tr>
<tr><td>Zip/Postcode</td><td colspan=3><input name=zip size=50></td></tr>
</table>

Next any additional costs can be considered

Handling and Shipping Fees

Only the item costs have been included so far. In addition to those there will be packaging and postage costs incurred. These can either be grouped together as a single cost for the whole transaction:

<input name=handling_cart value="5">

Or they can be applied to the individual items:

<input name=shipping_1 value="3">
<input name=handling_1 value="2">

The form is now ready to be added to a web page. It's then just a matter of sitting back any waiting for those payments to start rolling in.

Summary

Paypal is a safe and secure way of making and (most importantly) receiving payments over the Internet. It can be added to a web site by:

  • creating a new Paypal account
  • adding an HTML form to a web page
  • including the product seller details in hidden fields
  • including the item details both in hidden fields and something that the potential buyer can see
  • requesting the customer deliver details (if required)
  • remembering to include any handling and shipping costs/li>

And with that the customer base suddenly extends to every country in the world.

Live Example

Live examples of the technique can be seen at Using Paypal on a Web Page.

Mark Alexander Bain - Mark Alexander Bain is a writer, Mo Bro and consultant for all aspects of software development at dsquared. He has also written regularly ...

rss
Advertisement
Advertisement
Advertisement