title: Paypal button and checkout with jquery
body: <p>I have this code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script&gt;
      /* Set rates + misc */
  var taxRate = 0.08;
  var shippingRate = 0.00; 
  var fadeTime = 300;
  
  
  /* Assign actions */
  $('.product-quantity input').change( function() {
    updateQuantity(this);
  });
  
  $('.product-removal button').click( function() {
    removeItem(this);
  });
  
  
  /* Recalculate cart */
  function recalculateCart()
  {
    var subtotal = 0;
    
    /* Sum up row totals */
    $('.product').each(function () {
      subtotal += parseFloat($(this).children('.product-line-price').text());
    });
    
    /* Calculate totals */
    var tax = subtotal * taxRate;
    var shipping = (subtotal &gt; 0 ? shippingRate : 0);
    var total = subtotal + tax + shipping;
    
    /* Update totals display */
    $('.totals-value').fadeOut(fadeTime, function() {
      $('#cart-subtotal').html(subtotal.toFixed(2));
      $('#cart-tax').html(tax.toFixed(2));
      $('#cart-shipping').html(shipping.toFixed(2));
      $('#cart-total').html(total.toFixed(2));
      if(total == 0){
        $('.checkout').fadeOut(fadeTime);
      }else{
        $('.checkout').fadeIn(fadeTime);
      }
      $('.totals-value').fadeIn(fadeTime);
    });
  }
  
  
  /* Update quantity */
  function updateQuantity(quantityInput)
  {
    /* Calculate line price */
    var productRow = $(quantityInput).parent().parent();
    var price = parseFloat(productRow.children('.product-price').text());
    var quantity = $(quantityInput).val();
    var linePrice = price * quantity;
    
    /* Update line price display and recalc cart totals */
    productRow.children('.product-line-price').each(function () {
      $(this).fadeOut(fadeTime, function() {
        $(this).text(linePrice.toFixed(2));
        recalculateCart();
        $(this).fadeIn(fadeTime);
      });
    });  
  }
  
  
  /* Remove item from cart */
  function removeItem(removeButton)
  {
    /* Remove row from DOM and recalc cart total */
    var productRow = $(removeButton).parent().parent();
    productRow.slideUp(fadeTime, function() {
      productRow.remove();
      recalculateCart();
    });
  }
      //@ sourceURL=pen.js
    &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>The full demo can watch here:
  <a href="http://codepen.io/justinklemm/pen/zAdoJ" rel="nofollow">http://codepen.io/justinklemm/pen/zAdoJ</a></p>
  
  <p>¿As I can pay by paypal with jquery checkout button?</p>
  
  <p>Example.</p>
  
  <p>Pay Total: $ 90.57 with Paypal</p>
  
  <p>My code button paypal:</p>
  
  <pre><code> &lt;input class="checkout" type="image" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" border="0" name="submit" style="vertical-align:middle" alt="PayPal"&gt;
  </code></pre>
  
  <p></p>
  
  <p>Thanks.</p>