# Invoices

Invoices record what the guest owes on workspaces configured for standard invoices (not charge
notes). They sit alongside receipts, credit notes, refund notes, refund reversal notes and payment
reversal notes under the shared `documents` GraphQL connection.

## Lifecycle

**Standard flow:** Draft → Issued → Paid and/or Credited

- **Draft** — Being prepared; not yet official.
- **Issued** — Live charge; counts toward balance.
- **Paid** — Payment allocated to cover the invoice.
- **Credited** — A credit note has reduced or cleared the charge.
- **Deleted** — Only **draft** invoices can be deleted. Issued invoices are corrected via credit
  notes or corrective invoices, not deleted.

An invoice can be partly paid and partly credited.

## E-invoicing lifecycle (Spain / Portugal and similar)

Where e-invoicing is enabled, issuance goes through the tax authority. The steps depend on the
market.

**Spain**

- Draft → **Issuing** → **Issued** (accepted)
- Draft → **Issuing** → **Rejected** (declined — can be corrected and re-submitted, which returns
  to Issuing)

- **Issuing** — Document locked while awaiting tax authority response. No credits, refunds, or
  edits during this state.
- **Rejected** — Submission declined. Document can be fixed and submitted again.

**Portugal**

- Draft → **Issued** (certified)
- Draft → back to **Draft**, flagged with **issue errors**, when the document is missing required
  information. It isn't resubmitted until you fix it and issue it again.

Portuguese invoices don't go through an Issuing or Rejected state. See
[e-Invoicing Portugal](/finance-and-accounting/e-invoicing/portugal/).

Workspaces **without** e-invoicing move directly from Draft to Issued.

## Field-level lifecycle (`issuedDetails`)

The lifecycle above is visible on the `issuedDetails` field of every accounting document:

| State | `issuedDetails` | `issuingStartedAt` | `issuedAt` |
| --- | --- | --- | --- |
| Draft | `null` | n/a | n/a |
| Issuing | non-null | set | `null` |
| Issued | non-null | set | set |

The Issuing row applies to Spanish e-invoicing. Portuguese invoices go straight from Draft to Issued.

`issuedDetails` is `null` until the issue command is dispatched. Once issuance has started,
`issuedDetails.issuingStartedAt` is set and remains set until issuance completes or is rejected by
the tax authority. Use `issuedDetails.issuedAt` to detect the terminal "issued" state, which is what
consumers should rely on to mark an invoice as fully issued.

> **Note:** Before May 2026 the `issuedDetails` outer null check meant "fully issued". From May 2026
> onwards it means "issuance has started", so existing consumers must switch to checking
> `issuedDetails.issuedAt != null` for the same semantics.

## Querying an invoice

```graphql
query Invoice($id: ID!) {
  accounting {
    documents(filters: { workspaceId: { eq: "workspace-id" }, id: { in: [$id] } }) {
      edges {
        node {
          id
          issuedDetails {
            displayDocumentNumber
            issuingStartedAt
            issuedAt
            balance { amount currency }
          }
        }
      }
    }
  }
}
```

```json
{ "id": "invoice-id" }
```

To list every issued invoice for a booking and retrieve its PDF, see
[Fetching document PDFs](/finance-and-accounting/integrations/fetching-document-pdfs/).

## Invoice types

- **Standard** — Rent and fees for the stay.
- **Damages** — Post-stay charges.
- **Corrective** — Fixes or replaces a previous issued invoice. Identified by its link to the
  document it corrects.

## Corrective invoices

When an issued invoice must be fixed, Lavanda issues a corrective invoice (after voiding the
previously issued invoice via the creation of a credit note) linked to the original. Follow that
link in your records.

## Example

Rent invoice issued at check-in, guest pays and receipt is auto-allocated, final payment clears the
balance.

Discounts are applied in the **booking journey**, not via credit notes. Credit notes are for voids
and billing corrections after issue.

## See also

- [Charge notes](/finance-and-accounting/document-types/charge-notes/) — separate document type used instead of invoices on some
  workspaces.
- [Allocations](/finance-and-accounting/allocations/) — how payments and credit notes settle an invoice's balance.
- Payments allocated against an invoice are described on the [Payments](/finance-and-accounting/payments/)
  page.
