当前正在运行PayPal Button的沙盒集成。
单击贝宝按钮后,将在以下位置创建createOrder方法:
paypal.Buttons({
createOrder: function() {
return fetch('php/registerPayPalPayment.php', {
method: 'post',
body: JSON.stringify({orderID: <?php echo $orderID; ?>}),
headers: {
'content-type': 'application/json'
}
}).then(function (res) {
console.log("Paypal: CreateOrder");
console.log(res);
return res.json();
}).then(function (data) {
console.log(data);
return data.id; // Use the same key name for order ID on the client and server
});
}
返回成功的响应:
{id: "32509608BX945762G", links: Array(4), status: "CREATED"}
登录到贝宝沙盒帐户后。 “创建”调用中发生错误:
ack: "error"
message: "Unhandled api error"
meta: {calc: "dc72e617fec59",…}
server: "Hkq76r..."
我不知道问题出在哪里,它在2019年12月之前运行良好。
最佳答案
等待约20分钟后,现在一切正常!
关于javascript - PayPal集成中出现“未处理的API错误”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60812381/