【发布时间】: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 的哪一部分可以让我访问人们向我支付的所有款项……知道吗?
【问题讨论】: