【发布时间】:2021-01-20 16:33:13
【问题描述】:
我正在尝试集成 PayPal,但出现以下错误
您可以在此处使用任何 PayPal 沙盒买家帐户测试代码: Codepen
这是我正在使用的代码
paypal.Buttons({
createOrder: function (data, actions) {
// This function sets up the details of the transaction, including the amount and line item details.
return actions.order.create({
purchase_units: [{
amount: {
value: '5.00'
}
}]
});
},
onApprove: function (data, actions) {
// This function captures the funds from the transaction.
return actions.order.capture().then(details => {
// This function shows a transaction success message to your buyer.
alert('Transaction completed by ' + details.payer.name.given_name);
});
}
}).render('#paypal-button-container');
关于错误的更多信息
【问题讨论】:
-
您可能应该关注之前发生的错误请求 400 错误...
-
是的,我认为是相关的
-
是的,URL 以
capture结尾,所以可以肯定地说它是相关的 :) -
正如 Chris 所说,您应该展开 POST 400 Bad Request,并发布所有详细信息。
-
@PrestonPHX 完成,更新了我的问题
标签: javascript paypal paypal-sandbox