我正在尝试在平台上实施Paypal结帐。我已经看过API的文档,并尝试了他们所说的各种方法,但是由于某种原因我无法做到。现在,我的代码被剪掉了。
payment: (data, actions) => {
return actions.payment.create({
address_details:{
street_number: "123",
street_name: "Test address"
},
address_portable:{
postal_code:"4590-555",
country_code:"PT"
},
payment: {
transactions: [
{
amount: {
total: this.TotalPrice,
currency: 'EUR'
}
},
],
note_to_payer: "Contact us for any questions on your order.",
}
});
}
提前谢谢!
答案 0 :(得分:1)
我知道这是前一段时间问的。我遇到了类似的问题,花了很多时间试图弄清楚API的工作原理。 PayPal文档[此处] [1]不太清楚。对我有用的解决方案是使嵌套在address
对象中的payer
对象内部的细节变形:
payment: (data, actions) => {
return actions.payment.create({
payer : {
address :{
address_details:{
street_number: "123",
street_name: "Test address"
},
address_portable:{
postal_code:"4590-555",
country_code:"PT"
}
}
},
payment: {
transactions: [
{
amount: {
total: this.TotalPrice,
currency: 'EUR'
}
},
],
note_to_payer: "Contact us for any questions on your order.",
}
});
}
[1]: https://developer.paypal.com/docs/api/orders/v2/#definition-payer