> ## Documentation Index
> Fetch the complete documentation index at: https://docs.upflow.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Your customer's average payment delay

> Learn how Upflow calculates the average payment delay per customer using weighted invoice amounts and how this metric feeds into the A-D rating.

## What is the Average Payment Delay, and how is it calculated?

The average payment delay is a metric calculated for each customer. It is visible on the Customers list view and the Customer details page and is used as part of the customer rating (A,B,C,D).

The delay is calculated as the difference between the `paid date` and `due date`, weighted by the invoice amount.

It also includes `OVERDUE` , `DISPUTED` invoices, in those cases, we use today's date to calculate the delay.

If an invoice is paid early, this could result in a negative value.

This is computed daily for all relevant customers at 12:00 UTC + 2hours.

<Tabs>
  <Tab title="🧮 Calculation">
    * An invoice's payment delay is the time elapsed between its due date and its payment.
    * The average payment delay for a batch of invoices is obtained by:
      * Multiplying the amount of each invoice by its payment delay
      * Adding up all the results
      * Dividing the total by the sum of all invoices' total amount
  </Tab>

  <Tab title="👇 Example">
    Let's imagine a customer with three invoices:

    * Invoice #**1**: **\$140**, paid within **7** days
    * Invoice #**2**: **\$85**, paid within **55** days
    * Invoice #**3**: **\$214**, overdue since **10** days

    ((140 × 7) + (85 × 55) + (214 × 10)) / (140 + 85 + 214)
    \= 17.8 — With their invoices paid within **18** days on average, this customer earns an **A\*** rating.
  </Tab>
</Tabs>

## How does the Average Payment Delay relate to Customer Rating?

We use the delay to calculate the rating according to the following rules. Note that the boundaries are inclusive, so A is up to and including 30 days.

| **Rating** | **Delay** |
| ---------- | --------- |
| A          | ≤ 30 days |
| B          | ≤ 60 days |
| C          | ≤ 90 days |
| D          | ≥ 91 days |

## Missing/empty average payment delay

If the above-mentioned feature isn't enabled, the average payment time does not appear in the client’s file it's because they have no invoice overdue nor paid.

Do you have any questions? Don’t hesitate to [contact us!](/en-us/essentials/get-started/contact-our-support-team)
