【问题标题】:How to void an authorization from PayPal for a third party merchant如何使第三方商家的 PayPal 授权无效
【发布时间】:2022-10-16 04:05:19
【问题描述】:

我正在尝试以authorizethird party merchant 的意图对事务执行无效操作

import paypal from "@paypal/checkout-server-sdk";
...
const req = new paypal.payments.AuthorizationsVoidRequest(id);
const voidRequest = await client.execute(req);
const refundId = voidRequest.headers['paypal-debug-id'];

但我收到一个错误Authorization failed due to insufficient permissions. You do not have permission to access or perform operations on this resource.

根据this link 我需要获得商家的额外许可

Note:For three party transactions in which a partner is managing the API calls on behalf of a merchant, the partner must identify the merchant using either a PayPal-Auth-Assertion header or an access token with target_subject.

我如何从商家那里获得这些许可?我需要为我的商家添加connect with paypal 按钮吗?甚至有这样的事情吗?

或者我只需要添加PayPal-Auth-Assertion (也不知道该怎么做,我如何获得商家 access_token/client_id ?

...
req.headers['PayPal-Auth-Assertion'] = generateAuthAssertionHeader("XXXX@XXXX.com");
...

const generateAuthAssertionHeader = async email => {
    const auth_1 = Buffer.from('{"alg":"none"}').toString('base64');
    const auth_2 = Buffer.from(`{"email":"${email}","iss":"${PAYPAL_CLIENT_ID}"}`).toString('base64'); //my PAYPAL_CLIENT_ID or my merchant? how can I get the merchant PAYPAYL_CLIENT_ID
    const auth_assertion_header = `${auth_1}.${auth_2}.`;
    return auth_assertion_header;
};

【问题讨论】:

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


    【解决方案1】:

    您的链接链接到 https://developer.paypal.com/api/rest/requests/#paypal-auth-assertion,它解释了标题。如果您的申请被 PayPal 批准用于该范围,则可以通过 Connect with PayPal 获得同意

    否则,请在商家登录到您的系统时询问他们自己的 REST APP 客户端 ID 和密码,并使用这些凭据作为第一方无效。

    【讨论】:

      猜你喜欢
      • 2013-05-03
      • 2016-05-09
      • 2015-04-09
      • 2021-12-01
      • 1970-01-01
      • 2014-07-05
      • 2011-08-02
      • 2011-05-14
      • 2015-10-20
      相关资源
      最近更新 更多