PP button with mutliple items

cash76
New Community Member

How do I create a pp button with multiple items?

Login to Me Too
1 REPLY 1

Snow-Cat
Advisor
Advisor

As the online button creator is great for creating basic standard button code, when you have a need for something out of the box, you have to manually create the code you need and depending on the your requirements, you may also need a custom script to manage the logic and pass the end choices to the PayPal Checkout Screens.   Your best option for sending multiple items for checkout is to use the "upload" method.  This is how 3rd party shopping carts use PayPal behind the scenes.  Using the "upload" method, you can offer many choices with one button verses setting up multiple Add to Cart item buttons.

Here's some more details using this method.  As you didn't provide any details of what you have in mind, below is just one way that the "upload" method can be demonstrated - this one uses check boxes and a script.

<!DOCTYPE html>
<html lang="en">

<head>

<title>Upload Method Example</title>

<!-- START META TAG SECTION -->
<meta name="Description" content="">
<meta name="KeyWords" content="">
<meta charset="UTF-8">
<!-- END META TAG SECTION -->


<!-- Start of Script -->
<SCRIPT LANGUAGE="JavaScript"><!--

var count=1;

function codename() {
count=1;

document.formname.item_name_1.value='';
document.formname.item_name_2.value='';
document.formname.item_name_3.value='';
document.formname.item_name_4.value='';
document.formname.amount_1.value='';
document.formname.amount_2.value='';
document.formname.amount_3.value='';
document.formname.amount_4.value='';

if(document.formname.item1.checked)
{
    document.formname.item_name_1.value = "Item 1";
    document.formname.amount_1.value = "2.00";
    count=count+1;
}
if(document.formname.item2.checked)
{
    if(count==2){
        document.formname.item_name_2.value = "Item 2";
        document.formname.amount_2.value = "5.00";
        count=count+1;
    }
    if(count==1){
        document.formname.item_name_1.value = "Item 2";
        document.formname.amount_1.value = "5.00";
        count=count+1;
    }
}
if(document.formname.item3.checked)
{

    if(count==3){
        document.formname.item_name_3.value = "Item 3";
        document.formname.amount_3.value = "9.00";
        count=count+1;
    }
    if(count==2){
        document.formname.item_name_2.value = "Item 3";
        document.formname.amount_2.value = "9.00";
        count=count+1;
    }
    if(count==1){
        document.formname.item_name_1.value = "Item 3";
        document.formname.amount_1.value = "9.00";
        count=count+1;
    }
}
if(document.formname.item4.checked)
{
    if(count==4){
        document.formname.item_name_4.value = "Item 4";
        document.formname.amount_4.value = "11.00";
        count=count+1;
    }
    if(count==3){
        document.formname.item_name_3.value = "Item 4";
        document.formname.amount_3.value = "11.00";
        count=count+1;
    }
    if(count==2){
        document.formname.item_name_2.value = "Item 4";
        document.formname.amount_2.value = "11.00";
        count=count+1;
    }
    if(count==1){
        document.formname.item_name_1.value = "Item 4";
        document.formname.amount_1.value = "11.00";
        count=count+1;
    }
}


}
//-->
</SCRIPT>
<!-- End of Script -->



</head>

<body>

<!-- START SAMPLE CODE SECTION -->


<!-- PARAGRAPH 1 -->
Upload Method Examples

<br><br>

Check Boxes Utilizing a Script.

<br><br><br>

<form name="formname" target="_self" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<!-- Replace "business" value with your PayPal Email Address or your Merchant Account ID -->
<input type="hidden" name="business" value="your PayPal Email Address or your Merchant Account ID">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_paynowCC_LG.gif:NonHosted">
<input type="hidden" name="amount_1">
<input type="hidden" name="amount_2">
<input type="hidden" name="amount_3">
<input type="hidden" name="amount_4">
<input type="hidden" name="item_name_1">
<input type="hidden" name="item_name_2">
<input type="hidden" name="item_name_3">
<input type="hidden" name="item_name_4">

<table>
    <tr>
        <td>CheckBox&nbsp;&nbsp;</td>
        <td>Item&nbsp;&nbsp;</td>
        <td>Price&nbsp;&nbsp;</td>
    </tr>
    <tr>
        <td>&nbsp;&nbsp;<input type="checkbox" name="item1" value="Item 1"></td>
        <td>Item 1&nbsp;&nbsp;</td>
        <td>$2.00</td>
    </tr>
    <tr>
        <td>&nbsp;&nbsp;<input type="checkbox" name="item2" value="Item 2"></td>
        <td>Item 2&nbsp;&nbsp;</td>
        <td>$5.00</td>
    </tr>
    <tr>
        <td>&nbsp;&nbsp;<input type="checkbox" name="item3" value="Item 3"></td>
        <td>Item 3&nbsp;&nbsp;</td>
        <td>$9.00</td>
    </tr>
    <tr>
        <td>&nbsp;&nbsp;<input type="checkbox" name="item4" value="Item 4"></td>
        <td>Item 4&nbsp;&nbsp;</td>
        <td>$11.00</td>
    </tr>
</table>


<br>

<input type="button" value="Reset Form" onClick="this.form.reset()">

<br><br>

<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" onclick="codename()" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>


<!-- END BUTTON EXAMPLES -->



<!-- END SAMPLE CODE SECTION -->

<br><br><br><br>
<hr align="left" width="50%" noshade>
<br><br>
NOTES:
<br>
In order to test the code, you must replace the &quot;business&quot; value variable with your PayPal Email Address or your Merchant Account ID.


</body>
</html>
Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.