Paypal Refund Rest Api v2-授权因权限不足而失败

时间:2019-02-27 14:11:03

标签: paypal paypal-sandbox paypal-rest-sdk

我能够成功执行以下API

/v2/checkout/orders
/v2/checkout/orders/{order_id}/authorize
/v2/checkout/orders/{order_id}/capture

为什么执行此处所述的PayPal退款时会收到“ NOT_AUTHORIZED”响应? -https://developer.paypal.com/docs/api/payments/v2/#captures_refund

POST请求

https://api.sandbox.paypal.com/v2/payments/captures/<Capture ID I got from capture request>/refund

回复

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

3 个答案:

答案 0 :(得分:0)

调用void和退款API时,我遇到了同样的问题;但是我转向使用付款API V1的capture_id退款,它可以正常工作;我已经发送电子邮件给贝宝,也许他们会告诉我如何解决;

答案 1 :(得分:0)

您必须与PayPal支持人员联系,以为V2退款和取消请求添加现有ClientId和Client机密(适用于PayPal V1 API的权限)的权限,没有其他方法可以为其设置权限。 如果您需要避免这种情况,那么只需从PayPal帐户中创建新的ClientId和Client机密,它就可以与PayPal V2 API正常工作。

答案 2 :(得分:0)

使用一组新的客户端ID和密码创建新应用程序对我来说很有效。