View Paypal shopping cart contents on my site

2019-07-19 12:17发布

问题:

I have paypal "add to cart" buttons set-up throughout my site and a "view cart" button at the top of every page.

The code for the view cart button is:

  <form target='paypal' action='https://www.paypal.com/cgi-bin/webscr' method='post'>
  <input type='hidden' class='displaynone' name='cmd' value='_cart' />
  <input type='hidden' class='displaynone' name='business' value='XXXXXXX123' />
  <input type='hidden' class='displaynone' name='display' value='1' />
  <input type='submit' class='paypalcart' value='View Cart' />
  </form>

Currently, clicking "view cart" opens up a new browser tab and displays the items added on a paypal website.

Instead, I'd like clicking the "view cart" button to take the user to my page www.example.com/cart and then have the contents of the paypal cart displayed on that page in a <div> or <iframe> (or something else).

Any suggestions?

Thanks very much.

回答1:

You can use Minicart Js. Source which really dont suit your requirement, but it does'nt redirect to paypal site when you click "Add to Cart" instead opens lightbox inside your own website eventually when you click "Checkout" it takes you to paypal checkout page. Sample Demo



回答2:

You need to build a custom cart into your website instead of using the PayPal cart. There are a number of ways to do this. Are you using WordPress, by chance? If so, I'd recommend installing WooCommerce, and then the PayPal for WooCommerce plugin.

If you're using some other type of framework you may be able to find a nice shopping cart solution for it. Otherwise, you'd just have to build it yourself.

Then you can either use the cart upload method to send cart details to PayPal for checkout, or you could go with the Express Checkout (which I would recommend) if you're familiar with web service API's.