PayPal Button that adds multiple items simultaneously

I am trying to have a single paypal button add multiple items to PayPal cart at same time rather than people needing to add each product one at a time. I am trying the following code which I found at https://stackoverflow.com/questions/3308898/paying-for-multiple-items-at-once-via-paypal

<form target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_cart">
    <input type="hidden" name="upload" value="1">
    <input type="hidden" name="business" value="Me@gmail.com">
    <input type="hidden" name="currency_code" value="US">

    <input type="hidden" name="item_first_1" value="beach ball">
    <input type="hidden" name="amount_1" value="10">
    <input type="hidden" name="quantity_1" value="1">

    <input type="hidden" name="item_second_2" value="towel">
    <input type="hidden" name="amount_2" value="20">
    <input type="hidden" name="quantity_2" value="1">

    <input type="hidden" name="cancel_return" value="https://example.com/make-a-payment.php">
    <input type="hidden" name="return" value="https://example.com/make-a-payment.php">

    <input type="submit" value="PayPal">
</form>

Ultimately I would like to generate these hidden user inputs based on user input, but I can’t even get the button to add products to the PayPal cart. When I click submit from the code above, the PayPal page says, Error detected" and the shopping cart remains empty. Any thoughts on what I’m doing wrong? Thanks!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.