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

# Invoices

> Records for tracking payments owed to you by your customers.

Invoices in Flowglad serve as detailed records justifying payments made by your customers. They provide a clear breakdown of charges, whether for recurring subscriptions, one-time purchases, or manually created bills.

## How Invoices are Generated

Invoices are created in two ways within Flowglad:

1. **Subscription Renewals:** An invoice is automatically generated for each billing cycle of an active subscription. It reflects the charges for that period based on the subscription plan.
2. **One-Time Purchases:** When a customer completes a checkout for a non-subscription product or service, an invoice is generated and typically marked as paid immediately upon successful payment.

## Invoice Structure & Line Items

Each invoice contains essential details like the issue date, due date, customer information, and potentially billing/shipping addresses.

A key part of the invoice is its **Line Items**:

* Line items detail specific goods or services being charged for.
* Each line item includes a `description`, `quantity`, and `price` (per unit, specified in the currency's smallest unit, e.g., cents for USD).
* Line items can be entirely custom; they **do not** need to be linked to a pre-existing Product or Price record in Flowglad (the `priceId` field is optional).

## Invoices vs. Payments

Think of an Invoice as the "what" a customer owes and why. Think of a payment as "how" the customer pays you and "when".

* **Invoice:** Details *what* a customer owes and *why* (e.g., Subscription renewal for Plan X, Consulting Services). It's the bill or statement of charges.
* **Payment:** Represents the actual transaction where funds were transferred to settle an invoice (or part of it).

Every payment processed through Flowglad is linked to an invoice (`invoiceId`) to maintain a clear audit trail.

## Invoice Numbering

Each invoice has a unique `invoiceNumber`. While you can assign specific numbers via the API during creation, Flowglad ensures uniqueness for tracking purposes.

## Invoice Statuses

An invoice progresses through various statuses during its lifecycle:

* `draft`: The invoice is being created and is not yet finalized or sent.
* `open`: The invoice has been finalized and issued to the customer, awaiting payment.
* `paid`: The invoice has been fully paid.
* `uncollectible`: The invoice is deemed unlikely to be paid and has been written off.
* `void`: The invoice has been cancelled before payment and is no longer valid.
* `refunded`: The full amount of a paid invoice has been refunded. (Note: `fully_refunded` might be used internally)
* `partially_refunded`: A portion of a paid invoice has been refunded.
* `awaiting_payment_confirmation`: Payment has been initiated but is pending final confirmation (e.g., for certain bank transfer methods).

## Receipts

Once an invoice is marked as `paid`, Flowglad automatically generates a corresponding Receipt. This serves as proof of payment for the customer and references the original invoice details. Both invoices and receipts can be viewed and downloaded as PDFs.

## Other API Operations

Besides creation, the Invoices API allows you to:

* **Retrieve (`GET`):** Fetch details of a specific invoice and its line items.
* **List (`LIST`):** Retrieve a list of invoices, with pagination and filtering options.
