15

I have some items for sale that have 2 and 3 levels of customization. Once set the user adds them to my onsite cart. Problem is, how can i send each item to paypal on checkout? The only code ive found for dynamic buttons supports only a single item.

<form method="post" action="https://www.paypal.com/cgi-bin/webscr" target="paypal">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="business" value="EMAIL">
<input type="hidden" name="item_name" value="Item #1">
<input type="hidden" name="item_number" value="123456">
<input type="hidden" name="amount" value="7.00">
<input type="hidden" name="shipping" value="0">
<input type="hidden" name="shipping2" value="0">
<input type="hidden" name="handling" value="0">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="return" value="http://www.yoursite.com/thankyou.htm">
<input type="hidden" name="undefined_quantity" value="1">
<input type="image" src="http://images.paypal.com/en_US/i/btn/x-click-but22.gif" border="0" name="submit" width="87" height="23" alt="Make payments with PayPal - it's fast, free and secure!">
</form>

I tried adding

<input type="hidden" name="item_name_2" value="Item #1">
<input type="hidden" name="item_number_2" value="123456">
<input type="hidden" name="amount_2" value="7.00">

But no positive result.

Any ideas?

mrpatg
  • 10,001
  • 42
  • 110
  • 169
  • Answer of this question is exist at http://stackoverflow.com/questions/3308898/paying-for-multiple-items-at-once-via-paypal/39814713#39814713 – Bhaskar Bhatt Oct 02 '16 at 07:16

2 Answers2

43

Here is the solution

<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="email@email.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="2.00">
<input type="submit" value="PayPal">
</form> 
mrpatg
  • 10,001
  • 42
  • 110
  • 169
  • 3
    People should not be using this solution anymore. Consider implementing PayPal's Express Checkout solution while it's so damn easy to manipulate form-data. Nevertheless the answer is correct but if you read it today I think it isn't the desired solution anymore. – Ben Fransen Aug 21 '12 at 12:41
  • Great point, however Paypal also does recommend a thorough validation of each of the items submitted by the form. Is this the right price for this product, is this the right receiver email, is this the right total, etc. I also use an extra layer where I submit a similar form to a validation page that submits the actual form to paypal. I have caught multiple IPs so far trying to change form data however. If you absolutely can't change, just make sure validation is really good. – Dante Cullari May 18 '15 at 15:25
  • @Ben not a concern when using IPN notification validation. – Joseph Persico Dec 27 '16 at 18:41
2

Why don't you send the total amount your client has to pay to PayPal?

Ben Fransen
  • 10,884
  • 18
  • 76
  • 129
  • id like their paypal reciept to reflect exactly what was ordered and paid for by item. Alternative is to bunch it all together. – mrpatg Nov 19 '09 at 08:51
  • 2
    Indeed, what you were looking for is the upload option which have to be set to 1. Here is some documentation about this: http://www.paypal.com/cgi-bin/webscr?cmd=_pdn_howto_checkout_outside#methodtwo While i was searching for your answer you allready figured it out i guess ;) – Ben Fransen Nov 19 '09 at 09:12
  • useful information though. Thanks for posting the link. I gave you credit on the answer btw. – mrpatg Nov 19 '09 at 09:49
  • 1
    @BenFransen thanks you for the link you shared:https://www.paypal.com/cgi-bin/webscr?cmd=_pdn_howto_checkout_outside#methodtwo with all the information about how to setup the paypal form!!! – ygaradon Apr 12 '12 at 12:04