paypal refund order API return 由于权限不足授权失败

paypal refund order API return Authorization failed due to insufficient permissions

目前我正在将订单金额重定向到工作正常的商家帐户

但是现在当我执行退款操作时出现权限错误

我遵循的步骤:

  1. 从 his/her 刷新令牌(存储在数据库中)获取商家的访问令牌(使用 https://api-m.sandbox.paypal.com/v1/identity/openidconnect/tokenservice API)

  2. 现在使用上面的令牌(来自第 1 步)进行下面的退款流程 API https://api.sandbox.paypal.com/v2/payments/captures/{captureId}/refund 其中

captureId : 从订单详情中获取

退款回复api:

{
    "name": "NOT_AUTHORIZED",
    "message": "Authorization failed due to insufficient permissions.",
    "debug_id": "60091a8e09195",
    "details": [
        {
            "issue": "PERMISSION_DENIED",
            "field": "capture_id",
            "value": "90Y75959CH863854A",
            "description": "You do not have permission to access or perform operations on this resource.",
            "location": "path"
        }
    ],
    "links": [
        {
            "href": "https://developer.paypal.com/docs/api/payments/v2/#error-PERMISSION_DENIED",
            "rel": "information_link"}
    ]}

谁能帮我找出我做错了什么?我该如何解决这个问题?

要确定您应该在授权期间尝试请求哪些范围,请使用您自己的凭据执行正常的 access_token 请求并查看返回的 scopes 变量。

https://uri.paypal.com/services/payments/refund 似乎相关。