【发布时间】:2020-04-10 13:08:54
【问题描述】:
我正在尝试使用 Javascript SDK 创建 PayPal 订单。如果 PayPal 返回非描述性 400 错误,我将无法添加项目。
这个标记工作正常:
return actions.order.create({
purchase_units: [{
description: "Stuff",
amount: {
value: '57.49',
currency_code: "CAD",
},
}],
application_context: {
brand_name: "MyBusiness",
shipping_preference: 'NO_SHIPPING'
}
});
这个标记,我在其中添加了金额明细,而项目没有:
return actions.order.create({
purchase_units: [{
description: "Stuff",
amount: {
value: '57.49',
currency_code: "CAD",
breakdown: {
item_total: '57.49',
}
},
items: [{
unit_amount: '57.49',
quantity: '1',
name: "item 1",
}],
}],
application_context: {
brand_name: "MyBusiness",
shipping_preference: 'NO_SHIPPING'
}
});
我正在关注此文档:
https://developer.paypal.com/docs/api/orders/v2/#definition-purchase_unit_request
https://developer.paypal.com/docs/api/orders/v2/#definition-item
我猜我添加细分的方式不起作用。但规范暗示它是数量 -> 细分。
【问题讨论】: