如何通过API获取我的PayPal账户的交易记录

4
我想获取我的PayPal账户的交易历史记录。就像我在登录时可以导出的相同数据一样。
所有的交易都不是通过REST API本身生成的。
我阅读了一些帖子,其中说在这种情况下不能使用“Transaction Search” API(https://developer.paypal.com/docs/api/transaction-search/v1/)。
我尝试了一下,但无法使其正常工作。
在我获得访问令牌之后:
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账户中现有的交易记录呢?一定有方法,因为有许多工具可以导入这些数据,但他们使用的是哪个API呢?

1个回答

2
我尝试了这个,但它没有起作用,我无法获取数据。是的,我在我的开发者账户中激活了“交易搜索API”。
激活后,您需要等待9小时,并确保您获得一个新的访问令牌,而不是与旧令牌相同的令牌。然后,您应该会收到包括https://uri.paypal.com/services/reporting/search/read的新[scope]。
如果没有返回该范围,则无法使用交易搜索API。
必须有一种方式,因为有很多工具可以导入此数据,但他们使用哪个API呢?
实际上,交易搜索API并不是非常有用 - 大多数人使用www.paypal.com中的报告选项卡并下载CSV文件。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接