Friday, March 20, 2009

Integrating Paypal Shopping cart

The PayPal Shopping Cart – Add to Cart

With the PayPal Shopping Cart, you can let buyers select multiple items on your website and Pay for them with a single payment. Buyers click Add to Cart buttons to add items to their Virtual PayPal Shopping Carts, and they click View Cart buttons to review the items in their Carts before they check out and make their payments.

Sample HTML Code for a Basic Add to Cart Button. The sample HTML code below illustrates a basic Add to Cart button with these features:
An item named “QA Testing”.
An item price of $990.95 USD.
􀁺 PayPal calculates tax and shipping based on rates that you set up in your PayPal account.
􀁺 The buyer’s PayPal Shopping Cart opens in a separate browser window or tab.

form target=paypal action=https://www.paypal.com/cgi-bin/webscr method=post

Identify your business so that you can collect the payments.
input type=hidden name=business value=abc@abc.com

Specify a PayPal Shopping Cart Add to Cart button.
input type=hidden name=cmd value=_cart
input type=hidden name=add value=1

Specify details about the item that buyers will purchase.
input type=hidden name=item_name Value=QA and Software Testing
input type=hidden name=amount value=990.95
input type=hidden name=currency_code value=USD

Continue shopping on the current webpage of the merchant site.
The below value is replaced when buyers click Add to Cart
input type=hidden name=shopping_url value=http://www.globalworldtech.com/services.html
input type=hidden name=shipping value=4
input type=hidden name=handling_cart value=24

Display the payment button.
input type=image name=submit border=0 src=https://www.paypal.com/en_US/i/btn/btn_cart_LG.gif
alt=PayPal - The safer, easier way to pay online
img alt="" border=0 width="1" height="1" src=https://www.paypal.com/en_US/i/scr/pixel.gif

form

Variables required to tell PayPal the type of form it is are:

1) cmd
The cmd variable is always required in a FORM. Its value determines which Website Payments Standard checkout experience you are using to obtain payment.

Allowed Values for cmd Variable
Value of cmd Description
a) _xclick The button that the person clicked was a Buy Now button
b) _donations The button that the person clicked was a Donate button
c) _xclick- subscriptions the button that the person clicked was a Subscribe button.
d) _cart For shopping cart purchases; these additional variables specify the Kind of shopping cart button or command:
􀁺 add – Add to Cart buttons this must be set to 1
􀁺 display – View Cart buttons other alternative to add
􀁺 upload – The Cart Upload command tells it’s a third party cart must be set to1.

2) shopping_url
Use the shopping_url variable to let PayPal control which page buyers return to when they click the Continue Shopping button.

3) handling_cart

Single handling fee to be charged cart-wide. If handling_cart is used in multiple Add to Cart buttons, the handling_cart value of the first item is used.

4) amount
Required Price of the item or the total price of all items in the shopping
Cart.

5) business
Required Your PayPal ID or an email address associated with your PayPal
account. Email addresses must be confirmed

6) item_name
Required Name of the item or a name for the entire Shopping Cart

7) currency_code
The currency of the payment. The default is USD.

8) shipping
The cost of shipping the item. This use of the shipping variable is valid only for Buy Now and Add to Cart buttons.

There are few other additional html variables like tax, tax_rate ,undefined_quantity,weight,weight_unit also can defined if required you can check the url
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables for all html variables.

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home