如何通过API获取我的PayPal帐户的交易历史记录

时间:2020-09-05 22:55:58

标签: php paypal paypal-rest-sdk

我想获取我的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帐户中现有的PayPal交易?必须有一种方法,有很多工具可以导入此数据,但是它们使用哪个API?

1 个答案:

答案 0 :(得分:2)

我尝试了一下,但是没有用,我无法获取数据。

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

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

没有返回该范围,则不能使用事务搜索API。

必须有一种方法,有很多工具可以导入此数据,但是它们使用哪个API?

Transaction Search API实际上不是很有用-大多数人使用www.paypal.com中的“报告”标签并下载CSV文件