PayPal API: The totals of the cart item amounts do not match order amounts

前端 未结 3 1389
北海茫月
北海茫月 2021-01-18 20:54

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

相关标签:
3条回答
  • 2021-01-18 21:08

    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 ...

    0 讨论(0)
  • 2021-01-18 21:11

    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.

    0 讨论(0)
  • 2021-01-18 21:14

    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.

    0 讨论(0)
提交回复
热议问题