Paypal Sync API - Transaction History / Search

julesnyc
Contributor
Contributor

Hi all,

 

I'm trying to work with the Paypal Sync API in order to get a list of transaction history. I'm able to pull transactions with a specific ID, but unfortunately it's not letting me pull in transactions through a start date and end date. 

 

From the API docs:

 

"You must also include either the transaction_date or transaction_id query parameter. You can optionally include other query parameters."

 

It doesn't seem to work if I don't do transaction_id, instead using transaction date. 

 

Anyone have any ideas?

Login to Me Too
1 ACCEPTED SOLUTION

Accepted Solutions
Solved

MTS_Justin
Moderator
Moderator

Hi,

Here is the command I use :

curl -v -X GET -H "Content-Type: application/json" -H "Authorization: Bearer [access token]" "https://api.paypal.com/v1/reporting/transactions?start_date=2018-01-01T00:00:00-0700&end_date=2018-0..."


Was my post helpful? If so, please give me a kudos!

View solution in original post

Login to Me Too
7 REPLIES 7

angelleye
Advisor
Advisor
Need to see a sample of the request/response.

Angell EYE - www.angelleye.com
PayPal Partner and Certified Developer - Kudos are Greatly Appreciated!
Login to Me Too

julesnyc
Contributor
Contributor

Hi!

 

Thanks for the reply. Just gave it another go so I could test what was up.

 

So - I'm getting a 401 even though I have a valid access token. Just did three queries:

 

one to just check that I was hitting the right api .

curl -v -X GET https://api.paypal.com/v1/reporting/transactions \
> -H "Content-Type: application/json" \
> -H "Authorization: Bearer [my access token here]"

Got this back

{"name":"INVALID_REQUEST","debug_id":"5ebbb637efb2c","message":"Invalid request - see details.","details":[{"location":"query","issue":"Either `start_date` and `end_date` or `transaction_id` should be present in query"}]}

which was expected. But now I knew I needed start date and end date to receive a valid list of transactions. 

 

Just to make sure,  I query a transaction ID search with my own account to make sure it works; it does.

 

Request:

curl -v -X GET https://api.paypal.com/v1/reporting/transactions?transaction_id=[id] \
> -H "Content-Type: application/json" \
> -H "Authorization: Bearer [token]"

Response:

 HTTP/1.1 200 OK
< Date: Mon, 19 Feb 2018 21:49:15 GMT
< Server: Apache
< paypal-debug-id: 57e58a22276b3
< HTTP_X_PP_AZ_LOCATOR: slca.slc
< Paypal-Debug-Id: 57e58a22276b3
< Set-Cookie: X-PP-SILOVER=name%3DLIVE5.API.1%26silo_version%3D880%26app%3Dapiplatformproxyserv%26TIME%3D1531349850%26HTTP_X_PP_AZ_LOCATOR%3Dslca.slc; Expires=Mon, 19 Feb 2018 22:19:15 GMT; domain=.paypal.com; path=/; Secure; HttpOnly
< Set-Cookie: X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT
< Vary: Authorization
< Content-Length: 759
< Cache-Control: max-age=0, no-cache, no-store, must-revalidate
< Pragma: no-cache
< Connection: close
< Content-Type: application/json;charset=UTF-8
[transaction info appeared below...]


SO to get to the final point, when I tried with start date and end date, I got a 401. Request and response below:

Request:

curl -v -X GET https://api.paypal.com/v1/reporting/transactions?start_date=2017-02-15T00:00:00+0000&end_date=2018-02-15T00:00:00+0000 \
> -H "Content-Type: application/json" \
> -H "Authorization: Bearer [access token]"

Response:

< HTTP/1.1 401 Unauthorized
< Date: Mon, 19 Feb 2018 21:50:12 GMT
< Server: Apache
< paypal-debug-id: 3ea0f291b33ae
< HTTP_X_PP_AZ_LOCATOR: slca.slc
< Paypal-Debug-Id: 3ea0f291b33ae
< Set-Cookie: X-PP-SILOVER=name%3DLIVE5.API.1%26silo_version%3D880%26app%3Dapiplatformproxyserv%26TIME%3D2487651162%26HTTP_X_PP_AZ_LOCATOR%3Dslca.slc; Expires=Mon, 19 Feb 2018 22:20:12 GMT; domain=.paypal.com; path=/; Secure; HttpOnly
< Set-Cookie: X-PP-SILOVER=; Expires=Thu, 01 Jan 1970 00:00:01 GMT
< Content-Length: 0
< Cache-Control: max-age=0, no-cache, no-store, must-revalidate
< Pragma: no-cache
< Connection: close
< Content-Type: text/plain; charset=ISO-8859-1
< 
* Closing connection 0
* TLSv1.2 (OUT), TLS alert, Client hello (1):

I was using the Ruby and Node SDKs, but have been working with curl to just get it to work.

Login to Me Too

MTS_Justin
Moderator
Moderator
Hello,

The response in our logs for this debug_id is "msg=Authorization Header rejected: NOT_PROVIDED NULL_VALUE" -- Please check your passing a value access token for this request

Was my post helpful? If so, please give me a kudos!
Login to Me Too

julesnyc
Contributor
Contributor

Hi!

 

Thanks for your reply. 

 

This was my initial guess as well, and I understand the debug log may say that, but I entered the same access token as in my second request example from my previous post. In that example, I made the request with the transaction_id instead of start_date and end_date. 

 

Is there a different access token I should be using? In my Paypal API Settings, I have transaction search available.

 

I saw elsewhere the same request formatted with different syntax - it said transaction_date. Can you please advise on the exact syntax I should be using when making my request in order to pull up a list of transactions for a user given a date range? Or on what I may need to change? I know that the access key was the same as what I was given.

 

Thank you

Login to Me Too
Solved

MTS_Justin
Moderator
Moderator

Hi,

Here is the command I use :

curl -v -X GET -H "Content-Type: application/json" -H "Authorization: Bearer [access token]" "https://api.paypal.com/v1/reporting/transactions?start_date=2018-01-01T00:00:00-0700&end_date=2018-0..."


Was my post helpful? If so, please give me a kudos!
Login to Me Too

Wow, thanks for this!

 

For documentation check out https://developer.paypal.com/docs/integration/direct/sync/

Login to Me Too

gdbaldw
Contributor
Contributor

Two criteria I have found:

 

1) After checking "Transaction Search", recreate your client credentials

2) Maximum Date range appears to be about 30 days.

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.