【发布时间】:2018-03-02 13:20:01
【问题描述】:
我使用 PHP SDK 从 PayPal 收到错误 "Item amount must add up to specified amount subtotal (or total if amount details not specified)"。
我从阅读文档中知道,当项目总数与指定的总数不匹配时会发生此错误。除了我的情况,它们确实加起来了。
通过阅读其他答案,我知道这些项目是按项目计算的。即商品的价格*数量,但错误仍然存在。
不过,更有趣的是,此错误发生在用户已经登录并按下“立即付款”按钮之后。
这里是交易对象(作为数组):
`array (
'amount' => array (
'currency' => 'GBP',
'total' => '558.48',
'details' => array (
'shipping' => '0',
'tax' => '93.08',
'subtotal' => '465.40',
),
),
'item_list' => array (
'items' => array (
0 => array (
'name' => 'Q-Connect Premium White A4 90gsm Inkjet Paper (500 Pack) KF01090',
'currency' => 'GBP',
'quantity' => 50,
'price' => '7.49',
),
1 => array (
'name' => 'Stabilo Point 88 Fineliner Pen Black (Pack of 10 with 5 neon pens free) UK12/110-8846885',
'currency' => 'GBP',
'quantity' => 10,
'price' => '9.09',
),
),
),
)`
如果运费为 0.00 英镑,请不要建议我删除运费,因为我已经尝试过了,如果运费 > 0,我仍然会收到错误
税款按小计 + 运费计算。所以在这种情况下 (465.40 + 0) * 1.2 = 558.48
类似地,465.40 + 93.08 + 0 = 558.48
【问题讨论】:
标签: php paypal paypal-sandbox paypal-rest-sdk