如何解决PayPal集成400错误请求/订单无法捕获
我正在尝试集成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');
有关错误的更多信息
解决方法
从“网络”标签测试您的Codepen,您将获得COMPLIANCE_VIOLATION,这可能是由于您要测试的帐户所在的国家/地区未在沙盒中正确设置。
尝试在沙盒中使用其他国家/地区进行测试。在https://www.paypal.com/signin?intent=developer&returnUri=https%3A%2F%2Fdeveloper.paypal.com%2Fdeveloper%2Faccounts%2F上创建一个新的业务帐户,然后使用新的ClientID / Secret创建一个新的REST应用。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。