Transaction Search API: Response 400 INVALID REQUEST
AndrewFerreira
New Community Member
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Jun-18-2021
04:36 PM
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
Labels:
- Labels:
-
Payments REST APIs
1 REPLY 1
Afreen_Waheed
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul-02-2021
06:27 AM
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!
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- IPN works in sandbox but not live in Sandbox Environment
- When I do PayPal capture Order, I keep on getting Invalid Request Connection in REST APIs
- Platform Marketplace integration approval in Sandbox Environment
- PAYER_ACTION_REQUIRED returned for Capture intent when calling v2 checkout orders in Sandbox Environment
- API TRANSACTION_REFUSED in Sandbox when Capturing Payment in REST APIs