List payments depending on refund status

currently if I want to use the APIs to determine if a refund was applied to a payment, I’d have to call several functions from the payments and the refunds api and match up the data, which would result in me receiving errors for making too many requests if I had a giant customer base.

My idea to alleviate this if I was working for square would be to allow the following additional inputs when trying to list payments or get a payment:

Input: Show payments that have refunds?
Response options:

  1. show only payments with refunds
  2. show only payments with no refunds attached
  3. I dont care (default option)

Input: Show payments between low value and high value. (no answer = don’t put a value limit)

Then in the returned response, also show the refund values if requested from input.

If this is implemented, then one would only need to call the payment API to determine if refunds are applied, cutting the load on your server of up to 50%.

Can such updates be applied to the API?

If your looking to filter on only refunded payments is there a reason your not first starting with ListPaymentRefunds? Each response will have the payment_id for any subsequent API call and you won’t have to worry about payments that don’t have a refund. :slightly_smiling_face:

The listpaymentrefunds does not have a customer_id which I rely on when listing payments to retrieve customer details (especially first name and email address).

I did notice that my question is partly answered by using the listpayments in the payments API and checking for the total refund amount (amount in the refunded_money array) to determine the status of the refund, but is there a way to filter listpayment results by refund amount?

Unfortunately, a ListPayments filter by refund isn’t currently available. We’re constantly working to improve our features based on feedback like this, so I’ll be sure to share your request to the API product team. :slightly_smiling_face: