I found a strange response using the GET payment that I’m not certain is intentional or not. Using [squareApiURL]/v2/payments/[TransactionID], I found it that if [TransactionID] is empty then the request appears to change from a single payment response to all payments. To me, I was expecting the trailing “/[empty]” would still indicate single transaction request, albeit a not found response.
I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:
Additional Documentation
If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.
The behavior you’re observing is expected. When you make a GET request to the /v2/payments endpoint without specifying a payment ID, the API assumes you’re trying to list all payments. If you want to retrieve a specific payment, you need to provide a valid payment ID. If the payment ID is not provided or is empty, the API defaults to listing all payments. If you’re trying to retrieve a specific payment and the payment ID is not known or is incorrect, the API will not be able to find the payment and will return a NOT_FOUND error.
This answer was reviewed by @Bryan-Square.
Ok. I had code in place for a NOT_FOUND response, but it was not expecting the all payments response. There was a strange condition in my app where the transaction_id could be empty and this code got confused.