问题描述
花了整整一天时间处理危险事情后,我不明白交易显示为已获批准,我得到了订单ID ,但没有任何费用(不适用于买方或接收方)。 在沙盒上成功测试后,我处于实时环境中。
代码很长,但是基本上在服务器端,我们首先创建事务:
const request = new paypal.orders.OrdersCreateRequest();
request.prefer("return=representation");
request.requestBody({
intent: 'CAPTURE',//CAPTURE
purchase_units: [{
amount: {
currency_code: currency,value: finalPrice
},payee: {
email_address: payee
},shipping: shipObj
}]
});
然后我们批准使用PayPal的订单:
let request = new paypal.orders.OrdersGetRequest(orderID);
let order;
try {
order = await client.execute(request);
}
catch (err) {
console.error("error",err);
return res.sendStatus(500);
}
此时,我得到order.result.status
= 已批准。
这是一个实时环境(客户端和密钥)。 如何将“批准”发送给开发者,并提供orderID但不收取费用? 这是一件非常危险的事情,并且可能从字面上破坏企业。
因此,我发现有一个指向您的订单ID的链接:
https://api.paypal.com/v2/checkout/orders/4PE63643WC652674S
如果您在此页面中查看,则会得到:
"message":"Authentication failed due to invalid authentication credentials or a missing Authorization header."
现在,只有上帝知道这意味着什么,并且这是订单ID 页面上的一条故障消息,这意味着orderID毫无意义
所以我还要用我的客户ID检查Paypal链接(应该与sdk中的 我 客户ID相同吗?):
https://www.paypal.com/sdk/js?client-id=xxxxxxxxx&[email protected]&disable-funding=credit,card¤cy=USD
看起来还可以,并包含正确的电子邮件。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)