Reputation: 1058
There are a lot of posts about this error, but they all not apply on me. I really don't understand why the amounts wouldn't match. I have ITEMAMT which matches AMT0 * QTY0. And AMT matches ITEMAMT + SHIPPINGAMT. I checked the docs over and over and it really should work this way. It works when I totally remove the shipping out of it...
The AMT in the checkout url is 73.9 too.
I really hope someone is familiar with this very confusing error, and knows what I am doing wrong...
Thanks in advance
Array
(
[TIMESTAMP] => 2013-01-24T22:56:09Z
[CORRELATIONID] =>
[ACK] => Failure
[VERSION] => 62.0
[BUILD] => 4181146
[L_ERRORCODE0] => 10413
[L_SHORTMESSAGE0] => Transaction refused because of an invalid argument. See additional error messages for details.
[L_LONGMESSAGE0] => The totals of the cart item amounts do not match order amounts.
[L_SEVERITYCODE0] => Error
)
Array
(
[PAYMENTREQUEST_0_PAYMENTACTION] => Sale
[L_PAYMENTREQUEST_0_NAME0] => XXXX
[L_PAYMENTREQUEST_0_NUMBER0] => 30533
[L_PAYMENTREQUEST_0_DESC0] => XXXX
[L_PAYMENTREQUEST_0_AMT0] => 30.95
[L_PAYMENTREQUEST_0_QTY0] => 2
[PAYMENTREQUEST_0_ITEMAMT] => 61.9
[PAYMENTREQUEST_0_TAXAMT] => 0
[PAYMENTREQUEST_0_SHIPPINGAMT] => 12
[PAYMENTREQUEST_0_INSURANCEAMT] => 0
[PAYMENTREQUEST_0_AMT] => 73.9
[PAYMENTREQUEST_0_CURRENCYCODE] => USD
[REQCONFIRMSHIPPING] => 1
[PAYMENTREQUEST_0_SHIPTOSTREET] => XXXX
[PAYMENTREQUEST_0_SHIPTOCITY] => XXXX
[PAYMENTREQUEST_0_SHIPTOSTATE] => XX
[PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE] => XX
[PAYMENTREQUEST_0_SHIPTOZIP] => XXXXXX
[PAYMENTREQUEST_0_SHIPTOPHONENUM] => XXXXXXXX
)
Upvotes: 5
Views: 6659
Reputation: 193
I also had the same problem few days ago when trying to communicate, then only i realized that these order totals do not really match, with some minute decimal places. If you try the communication with some whole numbers like 50, as item amt and total (without any precession) then it will not give any error. I was also breaking my head and though paypal has some problem. (but really i was) So you better check the calculations and note that paypal will accept amounts upto only 2 precession or decimal places. I agree with Samuel on what he said.
Even the shipping amount you better send them as 12.00 instead of 12 and other numbers like 61.90, 73.90 ...
Upvotes: 0
Reputation: 1058
The answer to my question is probably not helpful to most of you passing by. But one of my items contained an & in the description (L_PAYMENTREQUEST_0_DESC0). '&' escaped the data passed through with CURL. And that created the error (which is totally off). Remember that this will also happen when you put in any characters that will contain an & when the URL is being encoded e.g. é will become é
I apologize for removing the item description from my first post, but i had no idea this had something to do with it, due to the error message about amounts.
Upvotes: 2
Reputation: 16828
It is mandatory that you send currency with 2 decimal places. It appears that you are only providing 1.
$amt = 61.9;
$amt = sprintf("%.2f",$amt); // 61.90
Paypal will return this error because the amount is not in the correct format:
Take a look at Table A.2
under the AMT
row:
http://www.paypalobjects.com/en_US/ebook/PP_NVPAPI_DeveloperGuide/Appx_fieldreference.html
This rule should apply every time you set a 'money' parameter.
Upvotes: 4