Menu Close

Adding a View Cart button when using Paypal with ASP.NET

If you have used Paypal with a simple website, you may be familiar with Paypal’s button creator.  It allows you to create HTML buttons that you can embed on your pages.  However this does not work so well with ASP.NET due to the multiple FORM elements.  I have found other examples of how to create “Add to Cart” buttons with ASP.NET and used those methods with success.  However, I could not find a simple example to create a “View Cart” button that linked to the PayPal shopping cart.  This is a very simple process.  

1) Add an ASP.NET button to your web form.

2) In the Click event for your button, add the following code (this is VB):

  Dim MerchantId as string = “xxxx” ‘set this to your Secure Merchant ID or Paypal Email Address 

  Response.Redirect(“https://www.paypal.com/cart/display=1&business=” & MerchantId)