You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

PayPal退款Rest API v2授权失败:已成功执行其他订单API却权限不足

PayPal Refund API Returns NOT_AUTHORIZED (PERMISSION_DENIED) for Capture ID

I’ve dealt with this exact error when working with PayPal’s v2 Payments API, so let’s break down the most likely causes and how to resolve them:

Common Causes & Fixes

1. Your OAuth Access Token Lacks Refund Permissions

Even though you can create orders, authorize, and capture payments, the refund operation requires specific scopes that might not be included in your current access token.

  • Check your token’s scopes: Call the PayPal token info endpoint to verify which permissions your token has. Run this command (replace YOUR_ACCESS_TOKEN with your actual token):
    curl -X GET "https://api.sandbox.paypal.com/v1/oauth2/token/userinfo" \
      -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
    
  • Ensure required scopes are present: You need at least payments.write (or the more granular refund:captures) scope. If it’s missing, re-generate your access token with the correct scopes when requesting it from the /v1/oauth2/token endpoint.

2. The Capture ID Belongs to a Different Merchant Account

PayPal strictly enforces resource ownership—you can only refund captures that were created by the same merchant account associated with your OAuth token.

  • Verify capture ownership: Check the original capture response (when you called /v2/checkout/orders/{order_id}/capture) to confirm the merchant account ID. Then cross-check it against the account linked to your API credentials.
  • Avoid using buyer account credentials: If you accidentally used a buyer’s sandbox account to generate the access token, you’ll get this error—only merchant (business) accounts have permission to issue refunds.

3. Sandbox Test Account Configuration Issues

In the PayPal Sandbox environment, it’s easy to mix up account roles:

  • Make sure you’re using a Business Sandbox Account to generate your OAuth token. Personal (buyer) sandbox accounts can’t perform refund operations on captures.
  • Double-check that the capture was created using the same business account’s credentials as the ones you’re using for the refund request.

4. App Permission Misconfiguration in PayPal Developer Dashboard

If your PayPal app isn’t configured with the right permissions, even a valid merchant token will fail:

  • Log into the PayPal Developer Dashboard, navigate to your app, and confirm that the "Payments" section includes permissions for refunds (look for "Refund payments" or similar).
  • If permissions are missing, update your app’s settings and re-generate your access token.

Quick Troubleshooting Tip

If you’re testing in Sandbox, try creating a new capture using the same merchant account’s credentials, then immediately attempt to refund it—this will rule out cross-account issues.

内容的提问来源于stack exchange,提问作者Sumeet

火山引擎 最新活动