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

前端 未结 3 1413
北海茫月
北海茫月 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条回答
  •  梦毁少年i
    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.

提交回复
热议问题