我正在编写一个服务(使用.NET Core 3.1和Refit,如果有影响),从我的PayPal商业账户中获取指定日期范围内的交易活动,以在管理仪表板上使用。目前,我正在按照这里的教程进行操作:
这让我在Postman和我的自定义服务中都成功获取了授权令牌。接下来,当我尝试拉取交易记录时(无论是在Postman还是代码中),我都会收到错误提示。
cUrl:
错误信息中的信息链接开始谈论第三方权限,我不确定是否适用,因为这是我的商业账户。有人有什么想法吗?我在PayPal的应用程序中检查了交易历史记录,所以我很困惑。
提前感谢。
https://developer.paypal.com/docs/api/get-an-access-token-postman/
这里:
https://developer.paypal.com/docs/api/transaction-search/v1/
首先,我可以轻松获取授权密钥(使用curl或postman,下面是curl命令)。
curl --location --request POST 'https://api.paypal.com/v1/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic <my client id>:<my secret>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
// not sure what this is, postman specific maybe?
--header 'Cookie: tsrce=devdiscoverynodeweb; ts=vr%3D0cee9361171ac120001362adffec14c3%26vreXpYrS%3D1679730671%26vteXpYrS%3D1585061694%26vt%3D0cee9390171ac120001362adffec14c2' \
--data-urlencode 'grant_type=client_credentials'
这让我在Postman和我的自定义服务中都成功获取了授权令牌。接下来,当我尝试拉取交易记录时(无论是在Postman还是代码中),我都会收到错误提示。
cUrl:
curl --location --request GET 'https://api.paypal.com/v1/reporting/transactions?start_date=2020-03-01T00:00:00Z&end_date=2020-03-31T23:59:59Z' \
--header 'Authorization: Bearer <my token>' \
// Postman???
--header 'Cookie: tsrce=devdiscoverynodeweb; ts=vr%3D0cee9361171ac120001362adffec14c3%26vreXpYrS%3D1679730671%26vteXpYrS%3D1585061694%26vt%3D0cee9390171ac120001362adffec14c2'
错误:
{
"localizedMessage": "No permission for the requested operation. ",
"suppressed": [],
"name": "PERMISSION_DENIED",
"message": "No permission for the requested operation. ",
"details": [
{
"field": null,
"value": null,
"location": null,
"issue": "No permission for the requested operation. "
}
],
"information_link": "https://developer.paypal.com/docs/classic/products/permissions/",
"debug_id": "7e315038e8073"
}
错误信息中的信息链接开始谈论第三方权限,我不确定是否适用,因为这是我的商业账户。有人有什么想法吗?我在PayPal的应用程序中检查了交易历史记录,所以我很困惑。
提前感谢。
https://uri.paypal.com/services/reporting/search/read
.. 如果没有,请双检你的REST应用设置是否为LIVE(不是sandbox)。 - Preston PHX{ "scope": "https://uri.paypal.com/services/payments/initiatepayment openid https://uri.paypal.com/services/applications/webhooks", ... }
- Kristof