I have a payment from 2024-01-18. Get payment retrieves the payment without issue. If I cut & paste the created_at date/time and place it into begin_time and end_time for the List payments endpoint (adjusting the times by -/+ and hour for begin/end), I receive a result set of {}. Does list payments have a time restriction whereas get payment has a longer one?
On a related note, I am researching a duplicate charge issue and I am trying to gather all the payments around this payment for a customer.
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:
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 ListPayments endpoint in the Payments API retrieves payments created in the authorized Square account. However, if you don’t specify a location ID, the endpoint returns payments taken at the default location. The endpoint supports pagination and a limit field that your application can use to indicate the page size (the number of items to return in the response). The default and maximum page size is 100 items.
If you’re not seeing the expected results, it could be due to the location ID not being specified or the results being spread across multiple pages. You can try specifying the location ID or adjusting the page size to see if that resolves the issue.
As for the time restriction, there shouldn’t be any difference between the GetPayment and ListPayments endpoints in terms of the time frame they cover. Both should be able to retrieve payments from the same time period.
For investigating a duplicate charge issue, you might want to use the SearchInvoices endpoint of the Invoices API, which allows you to search for invoices at a specific location and optionally filter by customer ID. This could help you gather all the payments around a specific payment for a customer.
This was the answer, missing location_id was the culprit. I added location_id to the request and started receiving the data I was expecting. Thank you.
You may want to emphasize the importance of location_id in the list payments documentation. While the example referenced by the AI referenced response above does include location_id, it just states “In this example, the request is filtering on: A single location…”, it comes across as optional to help fine tune the result set.