如何通过 API 获取我的 PayPal 账户的交易历史

How to get my PayPal account's transaction history via API

我想获取我的 PayPal 账户交易历史记录。与我登录时可以导出的数据相同。

那里的所有交易不是通过 REST API 本身生成的。

我读了一些帖子,上面说不能使用,例如,在这种情况下,“事务搜索”API (https://developer.paypal.com/docs/api/transaction-search/v1/)。

我试过了,但无法正常工作。

在我得到我的access_token之后:

stdClass Object
(
[scope] => https://api.paypal.com/v1/payments/.* openid https://api.paypal.com/v1/vault/credit-card/.* https://uri.paypal.com/services/subscriptions https://uri.paypal.com/services/identity/activities https://api.paypal.com/v1/vault/credit-card
[access_token] => xxx
[token_type] => Bearer
[app_id] => xxx
[expires_in] => 32400
[nonce] => 2020-09-05T22:25:09ZHAnra0QUpsxgo4E90gqEKtgtUNgkGNzVs1IVCBJfiu0
)

我试着给 /v1/reporting/transactions API 打了电话,然后回来了:

stdClass Object
(
[localizedMessage] => No permission for the requested operation. 
[suppressed] => Array
    (
    )

[name] => PERMISSION_DENIED
[message] => No permission for the requested operation. 
[details] => Array
    (
        [0] => stdClass Object
            (
                [field] => 
                [value] => 
                [location] => 
                [issue] => No permission for the requested operation. 
            )

    )

[information_link] => https://developer.paypal.com/docs/classic/products/permissions/
[debug_id] => feb53d91bc653
)

响应中的“information_link”以 404 结尾。

是的,我在我的开发者帐户中激活了“交易搜索 API”。

然后我发现这个旧的API:

https://developer.paypal.com/docs/archive/express-checkout/ht-searchRetrieveTransactionData-curl-etc/#

在那里,PayPal 表示这个 API 已被弃用,但仍然可以使用......对于正在使用它的客户。

对我来说,这也行不通,回复:

{
    "name": "INTERNAL_SERVICE_ERROR",
    "message": "An internal service error has occurred",
    "debugId": "a2b554e8cc7b",
        "links": [
        {
            "href": "https://developer.paypal.com/docs/api/overview/#error",
            "rel": "information_link"
        }
    ]
}

那么如何通过 API 获取我的 PayPal 帐户的现有 PayPal 交易?一定有办法,导入这个数据的工具有很多,但是他们用的是哪个API?

I tried this out, it don't worked, I could not get the data.

And yes, I activated "Transaction Search API" in my Developer Account.

激活后您需要等待 9 个小时,并确保您获得一个与旧的不同的新 access_token。然后你应该有一个新的 [scope] 返回,其中包括 https://uri.paypal.com/services/reporting/search/read

如果不返回该范围,您将无法使用交易搜索 API。

There must be a way, there are many tools who import this data, but which API do they use?

交易搜索 API 实际上不是很有用 -- 大多数人使用 www.paypal.com 中的“报告”选项卡并下载 CSV 文件