ajax loader

jPayPalCart jQuery Plugin

written by - Ian Scotland

jPayPalCart is a simple to integrate JQuery plugin that allows you to create a fully functioning Paypal shopping cart without using clunky server-side page refreshes. The plugin supports PayPal Website Payment Standard.


  • Apply to any html element.
  • Specify optional mini-cart element to display item count and net cost.
  • No window refresh when adding,removing or updating the cart
  • Easy set-up
  • Support PayPal Website Payment Standard
  • Support any currency, just set the currency and currency symbol.
  • Easy customization with CSS
  • Set items as virtual (downloads only) to override delivery
  • Set Vat on individual items.
  • Set cart persistence number of days (default is session)
  • Option to disallow quantity updating in the cart
  • Option to set PayPal NotifyURL.


I originally wrote this for a simple site that just needed a simple way to add multiple items to paypal order without having to endure the tedium of clicking in and back from the paypal basket. Here is that original cart implementation –ScaleAccompaniments.com. We later then added options including persistence and vat and more advanced styling of the basket for After Hours. Please ask us if you would like your own custom implementation of the cart!


Click here to download!
The download contains the plugin jPayPalCart.js (13k!!), jPayPalCart.min.js (Minified version just 7k!!) and the stylesheet jPayPalCart.css (1k).

Support Us

To continue to support this plugin does take time and energy, so to help keep the project alive please consider donating.

jPayPalCart Usage

<!– CSS files –>
<link rel=”stylesheet” type=”text/css” href=”js/jPayPalCart.css” />

<!– Script files –>
<script src=”js/jPayPalCart.js” type=”text/javascript”></script>

<script type=”text/javascript”>
// Create a basic cart
$(“#myCart”).PayPalCart({ business: ‘yourselleremail@yourdomain.com’,
notifyURL: ‘http://www.yournotifyURL.com/notify.php’,
virtual: false, //set to true where you are selling virtual items such as downloads
quantityupdate: true, //set to false if you want to disable quantity updates in the cart
currency: ‘GBP’, //set to your trading currency – see PayPal for valid options
currencysign: ‘£’, //set the currency symbol
minicartid: ‘minicart’, //element to show the number of items and net value
persitdays: 0 //set to -1 for cookie-less cart for single page of products,
// 0 (default) persist for the session,
// x (number of days) the basket will persists between visits

Include the above script within the <head> tag after the reference to the jQuery library. Also insert a <div id=”myCart”></div> holder for the cart itself.


Add an item to the cart. The code is the key field and must be supplied and unique for each product.

$(“myCart”).PayPalCart(‘add’, code, description, quantity, value, vat);
To remove an item from the cart use the code of the item.

$(“myCart”).PayPalCart(‘remove’, code);
Update to change the quantity of the item in the cart.

$(“myCart”).PayPalCart(‘update’, code, quantity);


Supported browser: Safari 5+, Firefox 3+, IE7+
Requires JQuery 1.5.x Javascript framework

What is JQuery?

jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development.
jQuery is designed to change the way that you write JavaScript.
You can find more about jQuery at www.jquery.com.