【问题标题】:How to access all transactions my PayPal account received via Api?如何访问我的 PayPal 账户通过 Api 收到的所有交易?
【发布时间】:2022-01-13 23:08:23
【问题描述】:

我在 PayPal 上有一个商业账户,我需要使用 API 来获取我账户中的所有交易(其他人通过 PayPal 支付给我的钱)。到目前为止,我设法使用 API 获得了access_token,但是当我尝试访问事务时出现错误。我的代码(PHP)如下:

$context = stream_context_create(array(

    "http" => array(
    
        "ignore_errors" => true,
        "method"  => "GET",
        "header" => array(
        
            "Content-Type: application/json",
            "Authorization: Bearer " . "access_token"
            
        )
        
    )
    
));

echo file_get_contents("https://api-m.paypal.com/v1/reporting/transactions?start_date=2022-01-01T00:00:00-0700&end_date=2022-01-12T23:59:59-0700&fields=all",0,$context);

我总是得到这样的回应:

{"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":"45cb548f7bddb"}

我点击了响应中的信息链接,但它最终出现在 404 页面中。也许我需要的不是交易 API,但我不知道 API 的哪一部分可以让我访问人们向我支付的所有款项……知道吗?

【问题讨论】:

    标签: api paypal


    【解决方案1】:

    对于您正在使用的the app/clientid,您是否启用了必要的权限?

    启用并保存该权限后,如果您拥有来自先前 oauth2 调用的缓存访问令牌以使用 API,则更改可能需要最多 9 小时才能生效。但是,您只需terminate your old access token 即可获得新的,而无需等待 9 小时。

    【讨论】:

    • 太棒了!工作过
    猜你喜欢
    • 2020-12-24
    • 2022-09-23
    • 2015-07-14
    • 2019-04-24
    • 2013-10-22
    • 2012-06-25
    • 2014-03-03
    • 2016-01-02
    • 2013-06-14
    相关资源
    最近更新 更多