我正在使用 Paypal 按钮 SDK。激活按钮的代码是:-
paypal.Buttons({
createOrder: ( data, actions ) => {
return actions.order.create({
purchase_units: [{
amount: {
value: this.amount.toFixed(2),
currency_code: "GBP",
}
}]
})
},
onApprove: ( data, actions ) => {
return actions.order.capture().then(details => {
console.log('details',details);
})
},
onError: ( error ) => {
console.log('error',error);
}
}).render('#paypal-button-container')
用户界面按预期运行,然后在返回错误之前有很长的停顿。脚本标签中使用的 client_id 用于沙盒帐户。我找不到描述错误可能原因的文档...
error 错误:无法捕获订单
非常感谢任何建议。
Paypal .. https://developer.paypal.com/docs/checkout/integrate/#1-get-paypal-rest-api-credentials
最佳答案
按照评论中的建议尝试使用此 URL 进行 curl :
https://www.sandbox.paypal.com/smart/api/order/ODER_ID/capture
它用代码 401 回复并进行了一些研究,最终发现我使用了错误的帐户进行付款。
我刷新 PayPal 登录并使用正确的沙盒买家帐户登录并进行付款,一切正常。
可能 paypal 应该给出正确的错误信息。
关于javascript - Paypal 按钮返回 'Order could not be captured',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55131325/