Paypal Smart Buttons 数码商品
Paypal Smart Buttons digital goods
我正在使用 Paypal Smart Buttons 收款以集成到我的数字平台中。
我卖的不是实物,而是Service/Digital好
我遵循了 Paypal 网站上的教程,并通过查看 Paypal 网络文档创建了此订单:
order = actions.order.create({
application_context: {
locale : "ITA",
shipping_preference:"NO_SHIPPING"
},
purchase_units: [{
description:"BLA BLA",
items:[
{
name: "BLA BLA",
category:"DIGITAL_GOODS",
quantity:"1",
unit_amount :{
currency_code:"EUR",
value : "5.00"
}
}
],
amount: {
currency_code: "EUR",
value: 5.00
}
}]
});
当我尝试时,我收到这个错误(通过 Google Chrome 开发工具控制台)
POST https://www.sandbox.paypal.com/v2/checkout/orders 422 (Unprocessable Entity)
我已经尝试删除 item
参数,这样做我在付款时没有任何问题,但我不确定这是否适合我的情况,我卖的是 Service/Digital好
正确的做法是什么?
您应该在开发工具中点击阅读422响应的正文;它包含一条包含有关该问题的完整信息的消息。
您缺少带有 item_total
的金额明细,这是传递订单项时所必需的。
请参阅有关此必需参数的文档:https://developer.paypal.com/docs/api/orders/v2/#definition-item
amount: {
currency_code: "USD",
value: '5.00',
breakdown: {
item_total: {
currency_code: "USD",
value: '5.00',
}
}
}
我正在使用 Paypal Smart Buttons 收款以集成到我的数字平台中。 我卖的不是实物,而是Service/Digital好
我遵循了 Paypal 网站上的教程,并通过查看 Paypal 网络文档创建了此订单:
order = actions.order.create({
application_context: {
locale : "ITA",
shipping_preference:"NO_SHIPPING"
},
purchase_units: [{
description:"BLA BLA",
items:[
{
name: "BLA BLA",
category:"DIGITAL_GOODS",
quantity:"1",
unit_amount :{
currency_code:"EUR",
value : "5.00"
}
}
],
amount: {
currency_code: "EUR",
value: 5.00
}
}]
});
当我尝试时,我收到这个错误(通过 Google Chrome 开发工具控制台)
POST https://www.sandbox.paypal.com/v2/checkout/orders 422 (Unprocessable Entity)
我已经尝试删除 item
参数,这样做我在付款时没有任何问题,但我不确定这是否适合我的情况,我卖的是 Service/Digital好
正确的做法是什么?
您应该在开发工具中点击阅读422响应的正文;它包含一条包含有关该问题的完整信息的消息。
您缺少带有 item_total
的金额明细,这是传递订单项时所必需的。
请参阅有关此必需参数的文档:https://developer.paypal.com/docs/api/orders/v2/#definition-item
amount: {
currency_code: "USD",
value: '5.00',
breakdown: {
item_total: {
currency_code: "USD",
value: '5.00',
}
}
}