Click here to Skip to main content
15,171,576 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
i want to send the multiple items in shopping cart using list..

can anyone give me the example code.. how can we do this??


C#
<input type="hidden" name="cmd" value="_cart" />

C#
<%=SelectedInvoice.PaypalItemList%>  //just like the way its done here. how i can right the function to pas multiple items to shopping cart.
Posted
Updated 1-Oct-16 23:01pm
v3
Comments
BobJanova 30-Sep-11 10:05am
   
Read the PayPal documentation. If I remember right, a multi-item shopping cart is one of their worked examples.

Hi, you can do that this way:

C#
<form id="Paypal" name="Paypal" 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="<%=System.Web.Configuration.WebConfigurationManager.AppSettings[" paypalemail="] %>" />
    <asp:repeater id="rptItems" runat="server" xmlns:asp="#unknown">
    <itemtemplate>
        <input type="hidden" name="item_name_<%# Eval("itemCount") %>" value="<%# Eval("itemValue") %>" />
        <input type="hidden" name="quantity_<%# Eval("itemCount") %>" value="<%# Eval("quantityValue") %>" />
        <input type="hidden" name="amount_<%# Eval("itemCount") %>" value="<%# Eval("amountValue") %>" />
    </itemtemplate>
    </asp:repeater>
    <input type="hidden" name="shipping_1" value="5" />
    <input type="hidden" name="handling_1" value="5" />
    <input type="hidden" name="tax_1" value="5" /> 
    <input type="hidden" name="currency_code" value="USD" />
    <input type="hidden" name="return" value="<%=System.Web.Configuration.WebConfigurationManager.AppSettings[" successurl="] %>" />
    <input type="hidden" name="cancel_return" value="<%=System.Web.Configuration.WebConfigurationManager.AppSettings[" failedurl="] %>" />
    <input type="hidden" name="lc" value="test lc country" />
    <input type="submit" value="Submit" />
    
    </form>


and your code behind must be:

C#
DataTable dtItems = new DataTable();
dtItems.Columns.Add("itemCount");
dtItems.Columns.Add("itemValue");
dtItems.Columns.Add("quantityValue");
dtItems.Columns.Add("amountValue");
dtItems.Rows.Add("1","Cellphone", "10", "200.00");
dtItems.Rows.Add("2", "Bag", "2", "250.00");
dtItems.Rows.Add("3", "Mouse", "10", "3500.00");
dtItems.Rows.Add("4", "Keyboard", "5", "200.00");

rptItems.DataSource = dtItems;
rptItems.DataBind();



Remember this is just an example so, sorry for the messy code. I hope this helps you. :D
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900