Paying for multiple items (at once) via paypal
See this sample and make the changes to yours accordingly. Basically add underscore to item name before number and give unique name to amount also with underscore and number.
You have to give amount to each item based on your carts totals.
<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="youremail@mail.com">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="item_name_1" value="beach ball">
<input type="hidden" name="amount_1" value="15">
<input type="hidden" name="item_name_2" value="towel">
<input type="hidden" name="amount_2" value="20">
<input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
Specify Quantity(optional)
<input type="hidden" name="quantity_1" value="1">
for more reference about cart: Paypal Cart
Pay Multiple items at once using PayPal REST API ASP.NET MVC
My guess, which is without seeing the full response is that your total does not add up with the details/item list. The validation adds up all the item values, which has to equal subtotal, the subtotal + tax etc (details) has to equal total.
sum (item.price * item.count) == sub total
sum of details == total
submitting multiple items to paypal cart at once with php
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>
How to show multiple items on Paypal
Cart upload (_cart
) is a very old (20 years?), deprecated integration method that doesn't give a good checkout experience.
The best solution is to use a smart button; see the current guide at Set up standard payments, particularly the section on extending the order creation with more detail:
createOrder: function(data, actions) {
return actions.order.create({
"purchase_units": [{
"amount": {
"currency_code": "USD",
"value": "100",
"breakdown": {
"item_total": { /* Required when including the `items` array */
"currency_code": "USD",
"value": "100"
}
}
},
"items": [
{
"name": "First Product Name", /* Shows within upper-right dropdown during payment approval */
"description": "Optional descriptive text..", /* Item details will also be in the completed paypal.com transaction view */
"unit_amount": {
"currency_code": "USD",
"value": "50"
},
"quantity": "2"
},
]
}]
});
},
Since you are using a PHP backend, for best results you should do this order creation and capture from your server via API instead of in the JS. There are notes in that guide for how to do a server integration and connect it to the JS with fetch(
, see the demo linked there.
Related Topics
Why Cannot Change Checkbox Color Whatever I Do
Change Name of Download in JavaScript
How to Get the Collection of Model State Errors in ASP.NET MVC
How to Rename HTML "Browse" Button of an Input Type=File
Is It Alright to Use Multiple H1 Tags on the Same Page, But Style Them Differently
Iframe with External Page Not Working
How to Embed Latex in a Webpage
Xpath Testing That String Ends with Substring
How to Keep Footer at Bottom of Screen
Remove Default Text/Placeholder Present in HTML5 Input Element of Type=Date
Css: Workaround to Backdrop-Filter
HTML Image Not Showing in Gmail
How to Apply a Color to a Svg Text Element
Dynamically Aligning Pseudo Element According to Parent Height