# How it works

How Lavanda keeps finance documents in sync with your systems.

## The goal

Your system reflects what the guest owes, what they have paid, and what has been credited or
refunded — aligned with Lavanda, in near real time.

## Webhooks and the AR API

- **Webhook** — Lavanda tells you a document changed. You receive its ID and the event type.
- **AR API** — You query Lavanda with that ID for the full document (amounts, balance,
  allocations, links).

Never treat the webhook alone as your source of truth.

## Typical sync loop

1. Lavanda changes a document.
2. You receive a webhook with the document ID.
3. You call the AR API for that document and its allocations.
4. You update your environment.

## What you mirror

For each booking you typically track:

- **Invoices OR charge notes** — what is owed. Your workspace is configured for one document type,
  not both.
- **Credit notes OR credit charge notes** — reductions, matching your charge document type.
- **Corrective documents** — replacement documents linked to an earlier issued invoice or charge
  note.
- **Receipts** — money collected.
- **Refund notes** — money returned.
- **Refund reversal notes** — refunds that never reached the guest, with the amount back on the
  receipt.
- **Payment reversal notes** — payments voided or taken back, for example after a lost dispute.
- **Allocations** — which payment or credit settled which charge.
- **Payments** — each payment's status, and why it failed, was cancelled or was disputed.
- **Saved payment methods** — each card or Direct Debit mandate's status, and for BACS the bank's
  view of it.

## What this guide does not cover

API credentials and permission setup — provided during technical onboarding. For field-level
reference on payments and payment methods, see
[Payments and payment methods](/finance-and-accounting/integrations/ar-payments-api/payments-and-payment-methods/).
