OMG,这个PayPal系统正在全力以赴!我有以下代码:
<script src="https://www.paypal.com/sdk/js?client-id=MY_CODE_HERE&vault=true"></script>
然后此脚本:
paypal.Buttons({
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: parseFloat( window.my_config.amount ),
currency: 'USD',
},
description: window.my_config.description,
invoice_id: invoice_id
}]
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
console.log({ details: details });
// do something here
});
$('#AJAXloadingWrapper').show();
},
onError: function (err) {
// Show an error page here, when an error occurs
console.log("ERROR")
console.dir(err);
}
}).render('#paypalWrapper');
它进入了很好的位置:
onApprove: function(data, actions) {
但是当它运行时:
return actions.order.capture().then(function(details) {
我收到一个错误,但它失败了:(没有拿走钱)
Error
code: undefined
columnNumber: 55441
fileName: "https://www.paypal.com/sdk/js?client-id=xxxx&vault=true"
lineNumber: 2
message: "Order could not be captured"
那甚至意味着什么?这是我传递给purchase_units
的示例:
我已经接近退出,并说“我们正在删除Paypal”。
更新:在我的搜索过程中,我不断想到有人告诉我该问题可能是来自PayPal,我正在使用重复的invoice_id。我知道不是这种情况,但也许我是错误地传递了它?
return actions.order.create({
purchase_units: [{
amount: {
value: parseFloat( window.my_config.amount ),
currency: 'USD',
},
description: window.my_config.description,
invoice_id: invoice_id
}]
});
},
答案 0 :(得分:3)
好的,所以我真的希望我的痛苦将来能对其他人有所帮助。我本人花了几个小时来解决这个问题,然后用贝宝(PayPal)支持技术来解决这个问题。最终的解决方案是擦除我的浏览器缓存。有点极端,但是似乎已经对它进行了排序。我希望我以前会想到这一点!