我正尝试在 PayPal Adaptive Payments API 中使用负数。首先,这似乎可行:
'item' => [
{
'itemPrice' => '25.00',
'name' => 'Cryptex - 16Gb USB Drive',
'price' => '25',
'itemCount' => 1
},
{
'quantity' => 1,
'name' => 'Special Discount',
'price' => '-2.50'
},
{
'itemPrice' => '5.00',
'name' => 'Shipping',
'price' => '5.00',
'itemCount' => 1
}
]
这是我在将其作为 JSON 提交并更新项目后看到的示例:
如您所见,价格是是正确的……但没有折扣金额的迹象?显然考虑到了这一点 - 否则价格将是 30 英镑,而不是 27.50 英镑(在 2.50 英镑折扣之后)
什么给了?这是 PayPal 系统中的错误吗?
FWIW,电子邮件也已损坏 - 它们根本不显示折扣金额。
更新:我已经向 PayPal 技术支持开具了一张罚单,因为我很确定这是他们系统的一个错误,而且目前无法修复 :( 真烦人!
更新 2: 来自 PayPal 的回复:
PayPal Adaptive Payments do not support negative item values. Since you did not pass the <itemPrice> in your API Call, the system did not throw the following error message:
[errorId] => 580022 [domain] => PLATFORM [subdomain] => Application [severity] => Error [category] => Application [message] => Invalid request parameter: itemPrice cannot be negative
I can see that the following was submitted to PayPal:
<item> <name>Special Discount</name> <identifier></identifier> <price>-2.50</price> <itemPrice></itemPrice> <itemCount></itemCount> <any>[quantity: null]</any> </item>
This object is basically incomplete and in order to apply discounts, you should apply them > onto the price for the main item and then submit it to PayPal.
我真的不确定他们建议我做什么?一个示例购物车是:
Item 1 - £10
Item 2 - £20
Item 3 - £50
Item 4 - £10
Delivery - £5
Total - £95
作为鼓励,我们有时会提供优惠券……所以它可能是“超过 50 英镑的订单可减 10 英镑”。所以在上面的例子中,它会将整体价格降至 85 英镑。
我真的不确定他们建议的替代方案是什么?
最佳答案
很有趣。正常付款没有该限制(我经常传递一个负数项目,就像您经常描述的那样)。
他们要您做的是取消另一件商品的折扣。因此,具有该折扣的示例购物车将是
Item 1 - £10
Item 2 - £20
Item 3 - £40 <-- Removed £10 discount
Item 4 - £10
Delivery - £5
Total - £85 <-- total reflects this
关于paypal - PayPal API 中的负数错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26906506/