Transaction Search API ... search for individual transaction by ID?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm trying to using the Transaction Search API to generate custom reports. Based on the documentation here:
https://developer.paypal.com/docs/integration/direct/transaction-search/
I expect to be able to retrieve individual transactions by specifying only transaction_id (i.e. without supplying start_date and end_date ), using a call like the one mentioned in the docs:
curl -v -X GET https://api-m.sandbox.paypal.com/v1/reporting/transactions?transaction_id=5TY05013RG002845M&fields=all&page_size=100&page=1 \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <Access-Token>"
However when I execute something like that (with valid ID) either with curl -or- the python requests library -or- either of paypal's python SDKs, I'm getting an error message that start_date and end_date MUST be specified:
curl -v -X GET "https://api-m.paypal.com/v1/reporting/transactions?transaction_id=58T98774JE736684D&fields=all&page_size=100&page=1" -H "Content-Type: application/json" -H "Authorization: Bearer ${LIVE_ACCESS_TOKEN}" -H "Accept: application/json" -H "Accept-Language: en_US"
Note: Unnecessary use of -X or --request, GET is already inferred.
* Trying 151.101.65.35:443...
* TCP_NODELAY set
* Connected to api-m.paypal.com (151.101.65.35) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server accepted to use h2
* Server certificate:
* subject: C=US; ST=California; L=San Jose; O=PayPal, Inc.; OU=CDN Support; CN=api-m.paypal.com
* start date: Apr 21 00:00:00 2020 GMT
* expire date: Apr 26 12:00:00 2022 GMT
* subjectAltName: host "api-m.paypal.com" matched cert's "api-m.paypal.com"
* issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 High Assurance Server CA
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle [Removed. Phone #s not permitted]
> GET /v1/reporting/transactions?transaction_id=58T98774JE736684D&fields=all&page_size=100&page=1 HTTP/2
> Host: api-m.paypal.com
> user-agent: curl/7.68.0
> content-type: application/json
> authorization: Bearer <ACCESS_TOKEN_HIDDEN>
> accept: application/json
> accept-language: en_US
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
< HTTP/2 400
< server: nginx/1.14.0 (Ubuntu)
< content-type: application/json
< cache-control: max-age=0, no-cache, no-store, must-revalidate
< paypal-debug-id: 6715fe68eef4b
< accept-ranges: bytes
< via: 1.1 varnish, 1.1 varnish
< edge-control: max-age=0
< date: Wed, 30 Dec 2020 06:58:07 GMT
< x-served-by: cache-sjc10066-SJC, cache-pao17438-PAO
< x-cache: MISS, MISS
< x-cache-hits: 0, 0
< x-timer: S1609311488.698907,VS0,VE60
< content-length: 205
<
* Connection #0 to host api-m.paypal.com left intact
{"name":"INVALID_REQUEST","message":"Invalid request - see details.","debug_id":"6715fe68eef4b","details":[{"location":"query","issue":"`start_date` and `end_date` should be present in query"}],"links":[]}
Why am I not getting the details for the transaction_id specified?
Is the error message about start_date and end_date the correct behavior of the API? even when specifying transaction_id? If so, the current documentation could make that a LOT clearer.
Also, I see user julesnyc reported on Feb 19, 2018 that they *did* get individual transaction details back (without specifying start_date and end_date):
https://www.paypal-community.com/t5/Sandbox-Environment/Paypal-Sync-API-Transaction-History-Search/m...
which suggests that the behavior has changed since then, since I'm getting a different result.
Lastly, I *could have sworn* that I actually did get the individual transaction details back successfully a few days ago when I was tinkering with the API with manual calls. If I'm not imagining that, then I'm wondering/guessing whether a recent update has changed the REST API behavior?
Thanks!
Nathan

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- [WooCommerce PayPal Payments] - Required phone country code, different than the cards country code. in PayPal Payments Standard
- Payments Refunded Automatically After Successful Transactions - PayPal Business Account Issue in REST APIs
- Paypal create transaction with QR - API in REST APIs
- Transactions according to unique APIs in SDKs
- Shopify PayPal integration, customer authorized multiple times in PayPal Payments Standard