Danzzz
Danzzz

Reputation: 535

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

I want to get my PayPal accounts transaction history. Just the same data I can export when I'm logged in.

All the transactions there where not generated via REST API itself.

I read some posts where it says that one can't use, for example, "Transaction Search" API (https://developer.paypal.com/docs/api/transaction-search/v1/) in this case.

I tried this out but could not get it to work.

After I got my 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
)

I tried to call the /v1/reporting/transactions API an got back:

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
)

The "information_link" in the response ends up at 404.

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

Then I found this old API:

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

There, PayPal says that this API is deprecated but will still work ... for customers who are using it.

For me, this also does not work, response:

{
    "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"
        }
    ]
}

So how to get existing PayPal transactions of my PayPal account via API? There must be a way, there are many tools who import this data, but which API do they use?

Upvotes: 4

Views: 2883

Answers (1)

Preston PHX
Preston PHX

Reputation: 30359

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.

After activating it you need to wait 9 hours, and ensure you get a new access_token that is not the same as your old one. You should then have a new [scope] returned which includes https://uri.paypal.com/services/reporting/search/read

Without that scope returned, you can't use the Transaction Search API.

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

The Transaction Search API is actually not very useful -- most people use the Reports tab in www.paypal.com and download a CSV file

Upvotes: 2

Related Questions