# Which Customers Are Paying Us Slower? Cash-Flow Software That Checks Each Manufacturer's QuickBooks Monthly

Cash-flow software for small manufacturers makes one agent per customer that reads their QuickBooks invoices and payments monthly and lists buyers who now pay later.

[Run this on Rush](https://cloud.getrush.ai/run/find-customers-paying-slower/quickbooks/). Opens the console with this prompt ready to send. Connect QuickBooks there first.

## What the agent does

This is for a company that sells cash-flow forecasting software to small manufacturers: machine shops, cabinet makers, food producers selling to distributors. Their forecasts depend on when customers actually pay, and the customer that used to pay in 32 days and now takes 55 is the one that leaves a gap in payroll week. The owner rarely notices the drift, because each invoice is only a little later than the last. The software adds a monthly Paying slower check, written by an agent that reads each manufacturer's own QuickBooks Online company.

The software saves the agent once as a template with `POST /o/{org}/agents`, naming `"connections": ["quickbooks"]` (it connects a QuickBooks company of its own first, because a template names connections its creator has) and instructions that keep it to reading. When a manufacturer turns the check on, its backend calls `POST /o/{org}/agents {"template": "<template id>", "name": "payments-<customer id>"}`, then `POST /o/{org}/agents/{agent}/connections {"type": "app", "name": "quickbooks"}`, and opens the `authorize_url` in a popup while the owner is signed in to the software. The owner signs in on Intuit's page and picks the company, so the software registers no Intuit app and stores only the agent id.

A run reaches the QuickBooks Online Accounting API for that company. It reads every `Payment` with a `TxnDate` in the last twelve months through the query endpoint, paging with `STARTPOSITION` and `MAXRESULTS`. Each payment's `Line` entries carry `LinkedTxn` items, and those whose `TxnType` is `Invoice` name the invoices it paid; the agent reads those invoices for their `TxnDate`, `DueDate`, `TotalAmt` and `CustomerRef`. For every invoice paid it works out days to pay (payment date minus invoice date) and days late (payment date minus due date). It also reads invoices that still have a `Balance` above zero and a `DueDate` before today.

Per customer it compares the median days to pay over the last 90 days with the nine months before, and flags a customer whose median grew by 10 days or more, with at least three paid invoices in each window. It writes `paying-slower.json` for the software: each flagged customer's name, both medians, the change, the invoices behind it, and what that customer owes now past due, plus a suggested days-to-pay for the forecast to use. It records nothing in QuickBooks: no payment, no note, no change to a customer's terms.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "<agent id>",
  "input": "Find customers who are paying us more slowly. Today is 2026-12-01. Use the QuickBooks connection, QuickBooks Online Accounting API, query endpoint only. 1) Query Payment where TxnDate >= '2025-12-01', paging with STARTPOSITION and MAXRESULTS until none are left. 2) For each payment, take each Line's LinkedTxn with TxnType Invoice, and read those invoices' TxnDate, DueDate, TotalAmt and CustomerRef. Where one payment pays several invoices, each invoice counts once with the payment's TxnDate. 3) For each paid invoice compute days to pay = payment TxnDate - invoice TxnDate, and days late = payment TxnDate - DueDate. 4) Per customer, compare the median days to pay for payments from 2026-09-02 to 2026-12-01 with 2025-12-01 to 2026-09-01. Flag a customer when the median grew by 10 days or more and each window has at least 3 paid invoices. 5) Query Invoice where Balance > '0' and read those with DueDate before 2026-12-01. Write paying-slower.json: per flagged customer the name, CustomerRef value, both medians, the change, the invoices behind each median, open past-due balance, and suggested_days_to_pay (the recent median). Also list customers with fewer than 3 paid invoices in a window under 'Too few payments to judge'. Do not create, update or delete anything in QuickBooks."
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

The run finds each customer who now pays later, by how many days, with the invoices that show it and what they owe past due today. The session returns `paying-slower.json` as an artifact. The software's webhook handler reads it into that manufacturer's dashboard, with a button to apply the new days-to-pay to the forecast.

What the owner checks before applying it: whether a slower customer changed terms on purpose (moved from 30 to 60 days in a new contract), which QuickBooks shows only when the invoice's due date was set to match; whether one large invoice in a dispute is pulling a median by itself; and whether to call the customer, change their terms or just plan for it. The run measures how payments moved. What the business does about a customer stays with the owner.

## Run it on every first of the month, per customer

The software's scheduler sends one `POST /o/{org}/sessions` per manufacturer with the check on, on the first of each month, with their agent id as `agent`, today's date and the window dates in `input`, and a `request_id` that is a UUID v5 of the customer id and the month, so a retried job starts no second run. Runs past the key's `max_concurrent` wait as `queued` until a slot frees, and the key's webhook delivers each `run.completed`.

The first run can start the moment an owner connects QuickBooks, so a new user sees their slow payers on day one instead of waiting for the first of the month.

## Why run it on Rush?

Each manufacturer's Intuit sign-in belongs to that manufacturer's agent, connected under it, so the software never holds an Intuit token and a run of one customer's agent cannot reach another customer's books. Every session lists in `accounts` the QuickBooks company's realm id it read, and `GET /o/{org}/sessions?account=<realm id>` lists every run that touched that company, which is the answer when an owner asks what the software has read.

Rush's QuickBooks app asks Intuit for the accounting scope, which can write as well as read; the template's instructions forbid writing, each run has its own computer, and its record lists every API call it made. Matching payments to invoices across a year of transactions is tedious by hand and routine for an agent, and runs for many companies go at once.

## Frequently asked questions

### Why the median and not the average?

One invoice paid six months late, often a dispute, moves an average a long way and a median hardly at all. The median follows how a customer usually pays, and the invoices behind it are listed so the owner can see the outliers.

### What about payments not linked to an invoice?

A payment with no `LinkedTxn` of type `Invoice`, such as a deposit recorded on its own, has no invoice date to measure from. The agent leaves it out of the medians and counts it in the answer, so an owner who records payments that way knows why a customer looks thin.

### Can the agent change a customer's payment terms?

No. It writes a suggestion for the forecast inside the cash-flow software. Terms in QuickBooks, and any conversation with the customer, stay with the owner.

### Does this work with QuickBooks Desktop?

No. Rush's QuickBooks app signs in to QuickBooks Online through Intuit and reaches the Online Accounting API, so the manufacturer needs a QuickBooks Online company.

## More QuickBooks jobs

- [Catch Duplicate Vendor Bills in QuickBooks Before Each Week's Payment Run](https://getrush.ai/run/find-duplicate-bills-before-paying/quickbooks/)
- [How Can Bookkeeping Software Find Customer Payments Still Sitting in Undeposited Funds? One Agent per Client Company in QuickBooks](https://getrush.ai/run/find-payments-not-yet-deposited/quickbooks/)
- [Which Customer Payments Never Got Applied to an Invoice? A Month-End Close App's Check of Each Client's QuickBooks](https://getrush.ai/run/find-unapplied-customer-payments/quickbooks/)

## More jobs like this: Run an agent per customer task

- [Which Days Next Week Have Nothing Scheduled? Gym Marketing Software That Checks Each Gym's Buffer Queue Every Friday](https://getrush.ai/run/find-empty-days-in-next-weeks-queue/buffer/)
- [List Every Google Drive File Shared With Anyone Who Has the Link, for Each Client Office](https://getrush.ai/run/find-files-shared-with-anyone-with-the-link/google-drive/)
- [Which Client Trips Had a Flight or Hotel Change Overnight? A Travel-Advisor App Reads Each Advisor's Gmail Every Morning](https://getrush.ai/run/find-flight-changes-in-each-advisors-inbox/gmail/)

## Keep reading

- [Connect QuickBooks to Rush once, then name it on any run](https://getrush.ai/integrations/quickbooks/)
- [Start your first run from the developer API quickstart](https://getrush.ai/docs/quickstart/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
