Search UNPAID Invoices

Has anyone figured out the JSON format for filtering the v2/invoices/search to only return invoices that are in UNPAID invoice status? I keep getting a 400 cause I cannot get the sweet spot of the invoice status filter for UNPAID

At this time since UNPAID isn’t a filter you can SearchInvoices for a location and query for only UNPAID invoices. :slight_smile:

can you explain why this code does not return the UNPAID invoices?

{
“query”: {
“filter”: {
“location_ids”: [
“”
],
“status”: [
“UNPAID”
]
}
}
}

Yes, happy to explain, UNPAID isn’t a filter that is available with the Invoices API. :slight_smile:

ok, so if I modified my JSON to the below, how do I query for only unpaid invoices?

{
“query”: {
“filter”: {
“location_ids”: [
“<EXAMPLE>”
],
}
}
}

You can’t filter on status. It sucks. I do a weekly job via the API and need to pull down ALL the invoices and filter them myself in code. IMO, this is fundamental functionality that’s just missing. It’s incredibly inefficient to pull down all invoices, requiring multiple iterative calls using the cursor, because, if you’re still in business, the vast minority of your invoices are actually UNPAID. As your business becomes more successful, this call becomes less and less efficient. Multiply that by all the customers trying to do this on a cyclical basis. Square is actually robbing themselves by requiring constantly increasing infrastructure overhead instead of making a small API enhancement.

agree 1,000% our business is the opposite. Most invoices are paid or cancelled. We only have a small few that are unpaid but I am trying to receive that info, and once something has been unpaid for 48 hours I want to make an API call to another software to carry out an action.

I guess I am stuck doing this manually for a hot minute unless I want to create full stack software to do all that

Nope, the point is exactly the same:

“the vast minority of your invoices are actually UNPAID”

This is the same as the majority are PAID.