Question

I am adding three item to papal cart screen but if i pass the second item amount blank it only add on item first item not the third .

 <form action="https://www.sandbox.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="sunil-facilitator@energysinfocom.com">
<input type="hidden" name="item_name_1" value="Item #1">
<input type="hidden" name="amount_1" value="1.00">


<input type="hidden" name="item_name_2" value="Item #2">
<input type="hidden" name="amount_2" value="">


<input type="hidden" name="item_name_3" value="Item #3">
<input type="hidden" name="amount_3" value="2.00">


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

above is the form and its adding only first item i am passing the price of second blank because that will come dynamically by check box so it may be blank if not checked .

Any help Appreciated

Was it helpful?

Solution

you need to have a value for your item variables. If you pass a blank value, it would be ignored by PayPal (all other items after item 2 as well). Instead of passing a blank value, you can use 0 with "amount_2" variable (i.e. if checkbox is not checked, amount_2="0").

Here's an HTML example:

<input type="hidden" name="amount_2" value="0">

<input type="checkbox" name="amount_2" value="1.00">
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top