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

# Overview

> Understand invoice amounts, statuses and how to retrieve a customer's invoices.

An invoice brings together the fees billed to a customer. It shows the billed items, taxes and total amount due.

Lago generates invoices from your [Contracts](https://getlago.com/docs/v2/guide/contracts/overview.md) and their billing settings. Invoice status tracks the document's lifecycle. Payment status tracks payment separately.

## How invoices are calculated

Lago calculates fees from the pricing applied to a Contract. It groups the fees on an invoice and calculates the taxes and totals.

Fees can share an invoice when their billing date in the customer’s timezone, currency, billing entity, payment method and purchase order number match, and consolidation is enabled. Without consolidation, Lago separates billing operations by Rate Card.

Each fee identifies the Product, quantity and pricing used. See [Fees](https://getlago.com/docs/v2/guide/invoicing/fees.md) for the line-item details.

```mermaid theme={"dark"}
flowchart LR
  A[Contract] --> B[Applied Rate Cards]
  B --> C[Rates]
  C --> D[Fees]
  D --> E[Invoice]
```

## Read an invoice

Review the billed items, billing periods, taxes and total. Check the amount still due separately from the invoice total.

| Detail | What it tells you |
| - | - |
| Fees | The items billed and their calculated amounts. |
| Billing periods | The dates covered by each fee. |
| Taxes | The taxes applied to the invoice. |
| Invoice total | The total amount on the invoice. |
| Amount due | The amount still outstanding. |

### Worked example

For one full monthly billing period, `contract_example` has a $100 fixed fee and 2,000 API calls at $0.01 each. Both are billed in arrears in USD. This example applies 20% tax, with no discounts, proration, credits or payments.

The applied Rate Cards are `monthly_service_usd`, with Rate `monthly_standard`, and `api_calls_usd`, with Rate `calls_standard`.

| Item | Calculation | Amount |
| - | - | -: |
| Monthly service | 1 × \$100.00 | \$100.00 |
| API calls | 2,000 × \$0.01 | \$20.00 |
| Subtotal before tax | | \$120.00 |
| Tax | \$120.00 × 20% | \$24.00 |
| **Total** | | **\$144.00** |

With no payments or credits applied, the amount due is also \$144.00. See [Taxes](https://getlago.com/docs/v2/guide/taxes.md) for tax configuration.

> [accordion] View the example's API amounts
>
> These illustrative values show how the example maps to invoice fields. In USD, `12000` represents \$120.00.
>
> | Field | Value |
> | - | - |
> | `fees_amount_cents` | `12000` |
> | `sub_total_excluding_taxes_amount_cents` | `12000` |
> | `taxes_amount_cents` | `2400` |
> | `sub_total_including_taxes_amount_cents` | `14400` |
> | `total_amount_cents` | `14400` |
> | `total_due_amount_cents` | `14400` |
>
> Each line is a fee with `product_code`, `rate_card_code`, `rate_code`, `units` and `amount_cents`. Request `expands[]=fees` to include the fees when retrieving the invoice.

For open billing periods, use [current usage](https://getlago.com/docs/v2/guide/events/retrieve-usage.md#retrieve-current-usage) to review provisional quantities and amounts.

## Invoice and payment statuses

An invoice's `status` describes the billing document. Its `payment_status` describes payment. A finalized invoice is not necessarily paid.

| Field | Purpose |
| - | - |
| `status` | Follow the invoice lifecycle, including `draft`, `finalized` or `voided` states. |
| `payment_status` | Check whether payment is `pending`, `succeeded` or `failed`. |

See [Draft invoices](https://getlago.com/docs/v2/guide/invoicing/draft-invoices.md), [Void invoices](https://getlago.com/docs/v2/guide/invoicing/void.md) and [Payment retries](https://getlago.com/docs/v2/guide/payments/payment-retries.md) for the actions available in each situation. The [API reference](https://getlago.com/docs/v2/api-reference/invoices/retrieve.md) lists all supported status values.

## Find invoices

> [tab] Dashboard
>
> 1. Open **Invoices** in the sidebar.
> 2. Use the filters to narrow the list.
> 3. Select an invoice.
> 4. Review its fees, taxes and payments.
>
> You can also open a customer and select the **Invoices** tab.

> [tab] API
>
> Use `GET /invoices` to list invoices. Filter by customer, status, date or other supported criteria. Results use cursor pagination and are ordered by `issuing_date`, newest first. See [List invoices](https://getlago.com/docs/v2/api-reference/invoices/list.md) for the available filters and [Pagination](https://getlago.com/docs/v2/api-reference/pagination.md) for navigating results.
>
> Use `GET /invoices/{lago_id}` to retrieve an invoice. Add `expands[]=fees` and `expands[]=applied_taxes` to include its fees and taxes.
>
> ```bash List finalized invoices of a customer theme={"dark"}
>     LAGO_URL="https://api.getlago.com"
>     API_KEY="__YOUR_API_KEY__"
>
>     curl --location --globoff --request GET "$LAGO_URL/api/v2/invoices?external_customer_id=customer_example&status[]=finalized&limit=20" \
>       --header "Authorization: Bearer $API_KEY"
> ```
>
> ```bash Retrieve an invoice with its fees theme={"dark"}
>     LAGO_URL="https://api.getlago.com"
>     API_KEY="__YOUR_API_KEY__"
>     INVOICE_ID="__YOUR_INVOICE_ID__"
>
>     curl --location --globoff --request GET "$LAGO_URL/api/v2/invoices/$INVOICE_ID?expands[]=fees&expands[]=applied_taxes" \
>       --header "Authorization: Bearer $API_KEY"
> ```
>
> Expanding more than 1,000 fees returns `400 expansion_too_large`. For larger invoices, use `GET /fees?lago_invoice_id=...` and page through the results. See [List fees](https://getlago.com/docs/v2/api-reference/fees/list.md).
>
> See [Retrieve an invoice](https://getlago.com/docs/v2/api-reference/invoices/retrieve.md) for the full list of supported expansions. You can also list a customer's invoices with [`GET /customers/{customer_external_id}/invoices`](https://getlago.com/docs/v2/api-reference/customers/list-invoices).
>
> The list returns Contract invoices and invoices containing Contract fees. Invoices produced only by the legacy engine are excluded; retrieving one returns `404`.
>
> The `invoice_type` list filter accepts `contract` and `advance_fees`. The latter was named `advance_charges` in v1. Invoices containing both legacy and Contract fees can return legacy invoice types; see the [invoice schema](https://getlago.com/docs/v2/api-reference/invoices/retrieve.md).

For specific operations, see the API references for [retrying invoice taxes](https://getlago.com/docs/v2/api-reference/invoices/retry-taxes.md), [recording a lost payment dispute](https://getlago.com/docs/v2/api-reference/invoices/lose-dispute.md) and [updating payment status](https://getlago.com/docs/v2/api-reference/invoices/update.md). To record money collected outside Lago, see [Record manual payments](https://getlago.com/docs/v2/guide/payments/record-manual-payments.md).

> [card] [Fees](https://getlago.com/docs/v2/guide/invoicing/fees.md)
>
> Read the line items behind an invoice.

> [card] [Draft invoices](https://getlago.com/docs/v2/guide/invoicing/draft-invoices.md)
>
> Refresh, finalize or delete a draft.

> [card] [Void invoices](https://getlago.com/docs/v2/guide/invoicing/void.md)
>
> Void an eligible invoice.

> [card] [Download and resend invoices](https://getlago.com/docs/v2/guide/invoicing/download-invoices.md)
>
> Download a PDF or resend an invoice email.

> [card] [Credit notes](https://getlago.com/docs/v2/guide/invoicing/credit-notes/overview.md)
>
> Correct a finalized invoice.

> [card] [Payment retries](https://getlago.com/docs/v2/guide/payments/payment-retries.md)
>
> Follow up on payment collection.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.