BAD_INPUT_ERROR on _cart upload

TheKLF99
New Community Member

I'm creating the following HTML code dynamically to produce a checkout button

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="###@####">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="item_name_1" value="Mugs">
<input type="hidden" name="quantity_1" value="1">
<input type="hidden" name="shipping_1" value="8.95">
<input type="hidden" name="amount_1" value="12.00">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" name="submit" alt="Make Payments with PayPal -- it\'s fast, free and secure!">
</form>

 

And yet everytime I click checkout I just get the error BAD_INPUT_ERROR

I've looked through the html code time and time again and there appears to be absolutely nothing wrong with it according to your documentation.  I've tried removing the shipping_1 and quantity_1 values so it's just the name and amount, I've added another item to the basket just in case it needs more than one item (calling the second item - item_name_2 and amount_2 as described in the PayPal docs).

I've tried changing it to just name="add" value="1" and item_name_1 to just item_name - that works fine - but I can only add one item at a time - I want to upload an entire shopping cart.

I've tried the PayPal smart buttons with their Javascript integration - I don't know why but the Paypal JS smart buttons seem to conflict with the CMS I'm using (Joomla 4).  They work fine in their own HTML page - but the minute I code them into Joomla either as a module or a component I just get a pop-up window for taking payment that takes me to "about:blank#blocked" - I thought it might be a pop-up blocker active but I've disabled my pop-up blockers, I've even tried in different browsers (Chrome and Edge) and both have the same error message - but using it outside of Joomla it's fine - in Joomla is just no.

It's really annoying me as I'm trying to create a shopping cart for a friend but up to now following all the documentation as per paypal has just led me to constant error after error and very little feedback from the system about what the error is - I mean what does "BAD_INPUT_ERROR" mean anyway - obviously I know it's an error on one (or more) of the parameters being passed - but which one?

The only way I can find to do it is just to Add To Cart buttons for each item in PayPal (where it has a button id for each button)- that seems to work but that could take ages when I've got a database already full with the items.

Login to Me Too
1 REPLY 1

MTS_Jennifer
Moderator
Moderator

Hello @TheKLF99 ,

Thank you for posting to the PayPal Community.

I tested your cart upload that you pasted with one of the sandbox accounts from the PayPal Developer website and was able to go through the checkout process with no issues.

https://developer.paypal.com/api/nvp-soap/paypal-payments-standard/integration-guide/cart-upload/#li...

Since you keep receiving bad input error that means the only issue may be the sandbox email or sandbox account that you are using.

Below is your code with the Sample Sandbox Email from the PayPal Developer website:

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="seller@dezignerfotos.com">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="item_name_1" value="Mugs">
<input type="hidden" name="quantity_1" value="1">
<input type="hidden" name="shipping_1" value="8.95">
<input type="hidden" name="amount_1" value="12.00">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" name="submit" alt="Make Payments with PayPal -- it\'s fast, free and secure!">
</form>

 

If you can provide the merchant id from your Business Sandbox Account, I can check to see if it has a confirmed email.

 

Thank you,

Jennifer

MTS

PayPal

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.