【发布时间】:2021-03-06 16:54:03
【问题描述】:
PayPal 的新手,正在修改沙盒。我的 test 订单正常。
我想验证来自我的服务器的订单并在后台处理配置任务以获得成功的订单。
onApprove: function(data, actions) {
// data has things that are of interest, see below.
....
}
data 有:
{
"orderID": "4P1187891ORDERID",
"payerID": "4MEHE6UPAYERID",
"paymentID": null,
"billingToken": null,
"facilitatorAccessToken": "aHR0cHM6Ly9hcGkuc2FFACILITATORACCESSTOKENtL3YyL2NoZWNrb3V0L29yZGVycy80UDExODc4"
}
他们的doc says这是我获取交易详情的方式:
curl -v -X GET https://api.sandbox.paypal.com/v2/checkout/orders/5O190127TN364715T \
-H "Content-Type: application/json" \
-H "Authorization: Bearer Access-Token"
所以我将 curl 命令定义为:
curl -v -X GET https://api.sandbox.paypal.com/v2/checkout/orders/4P1187891ORDERID \
-H "Content-Type: application/json" \
-H "Authorization: Bearer aHR0cHM6Ly9hcGkuc2FFACILITATORACCESSTOKENtL3YyL2NoZWNrb3V0L29yZGVycy80UDExODc4"
我在上面的 curl 中使用 facilitatorAccessToken 作为 Access-Token,它失败了:
{"name":"NOT_AUTHORIZED","details":[{"issue":"PERMISSION_DENIED","description":"You do not have permission to access or perform operations on this resource."}],"message":"Authorization failed due to insufficient permissions.","debug_id":"420XXXXX03","links":[{"href":"https://developer.paypal.com/docs/api/orders/v2/#error-PERMISSION_DENIED","rel":"information_link"}]}
以前有人遭受过这种情况吗?我假设 facilitatorAccessToken 可以用作 Access-Token 来获取交易详情 - 不是这样吗?
【问题讨论】: