Transaction Search API: Response 400 INVALID REQUEST

AndrewFerreira
New Community Member

 

Hi everyone,

 

I am trying to get a list of all transactions from my PayPal Business account by using the Transaction Search API, but I keep getting the 400 INVALID_REQUEST response. 

According to this documentation, I am doing everything correctly with the headers. Could anyone here help me?

 

 

import requests, json

USERNAME = <MY USERNAME>
KEY = <MY SECRET KEY>
TOKEN = <MY TOKEN - GENERATED BY POSTMAN>

headers = {"Content-Type": "application/json",
           "Accept-Language": "en_US",
           "Authorization": "Bearer <MY TOKEN>",
           "Accept": "application/json"
          }

LINK = "https://api-m.paypal.com"
GET = "/v1/reporting/transactions?start_date=2021-01-01T00:00:00-0700&end_date=2021-06-01T00:00:00-0700"
GET_LINK = LINK + GET

response = requests.get(GET_LINK, auth=(USERNAME, KEY), headers=headers)
print(response)

 

 

Thanks

Login to Me Too
1 REPLY 1

Afreen_Waheed
Contributor
Contributor

Hi Andrew,

 

From the Transaction Search documentation, we can see that the maximum supported date range is 31 days. In your request, the difference between the start_date and end_date is more than 31 days, that's why the INVALID REQUEST! Change it and try.

 

Thanks!

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.