Buying more than one item through Add to Cart PayPal

I am working on the purchase of more than one item through the add to cart paypal button. Here is my code:

<form 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="seller_1360303883_biz@gmail.com"/>
          <input type="hidden" name="currency_code" value="USD"/>

          <input type="hidden" name="item_name_1" value="Item Name 1"/>
          <input type="hidden" name="amount_1" value="$<?php  echo $price1 ?>"/>
          <input type="hidden" name="shipping_1" value="1.75"/>
          <input type="hidden" name="quantity_1" value="1"/>

          <input type="hidden" name="item_name_2" value="Item Name 2"/>
          <input type="hidden" name="amount_2" value="$<?php  echo $price2 ?>"/>
          <input type="hidden" name="shipping_2" value="2.50"/>
          <input type="hidden" name="quantity_2" value="1"/>

          <input type="hidden" name="item_name_3" value="Item Name 3"/>
          <input type="hidden" name="amount_3" value="$<?php  echo $price3 ?>"/>
          <input type="hidden" name="shipping_3" value="2.50"/>
          <input type="hidden" name="quantity_3" value="2"/>

                         

       <!-- <input type="submit" value="PayPal"/> -->

        </form>

Using the above code i; getting error:

"You entered an invalid quantity value. The quantity value must be an integer greater than or equal to one."

I looked for it and tried the sentences, but none of them worked. Any help would be great!

+3
source share
3 answers

I think that you use the sandbox and in the form that you put in the form of action paypal insetead sandbox paypal

+1
source

, , . , .

0

It works for me when I use a semicolon in every PHP statement.

<?php

$price1=12.99;
$price2=13.49;
$price3=17.99;

?>

<input type="hidden" name="amount_1" value="<?php  echo $price1; ?>"/>
<input type="hidden" name="amount_2" value="<?php  echo $price2; ?>"/>
<input type="hidden" name="amount_3" value="<?php  echo $price3; ?>"/>

You might want to check that you have reasonable prices.

0
source

All Articles