# Account Receivable & Payments API integration

The primary way to keep your systems aligned with Lavanda: a GraphQL **AR & Payments API** paired
with **webhooks**. This page is the entry point — start here, then follow How it works and What is
available today.

## What this is about

Lavanda tracks money owed and money received for each booking through **finance documents** —
invoices or charge notes, receipts, credit notes, refund notes, refund reversal notes and payment
reversal notes — linked together by
**allocations**. This integration lets your systems mirror that picture in near real time. It also
covers **payments** and the **payment methods** (cards and Direct Debit mandates) saved on each
booking — see [Payments and payment methods](/finance-and-accounting/integrations/ar-payments-api/payments-and-payment-methods/).

## How updates reach you (webhooks)

1. Something changes in Lavanda.
2. Lavanda sends a **webhook** with the ID of the document, payment or payment method, and the type
   of change.
3. You call the **AR API** with that ID for the full record.
4. You update your own records.

The webhook is the alert; the AR API response is the full record. See
[Staying up to date](/finance-and-accounting/integrations/ar-payments-api/staying-up-to-date/) for the full pattern — which events to subscribe to and
what to refresh after each.

## Document flows at a glance

| Document | Typical journey |
| --- | --- |
| Invoice | Draft → Issued → Paid and/or Credited |
| Charge note | Draft → Issued → Paid and/or Credited |
| Credit note | Issued → Applied to invoice |
| Credit charge note | Issued → Applied to charge note |
| Receipt | Issued → Applied — or Reversed / Refunded (a reversed refund steps it back to Partially refunded or Issued) |
| Refund note | Issued → Linked to receipt — may become Reversed |
| Refund reversal note | Issued → Allocated in full to the refund note it reverses (final) |
| Payment reversal note | Issued → Linked to receipt |

Workspaces with e-invoicing in Spain add **Issuing** and **Rejected** steps before Issued. In
Portugal an invoice goes from Draft to Issued, or back to Draft with issue errors — see
[Invoices](/finance-and-accounting/document-types/invoices/).

## Payment flows at a glance

| Record | Typical journey |
| -------------- | ------------------------------------------------------------------ |
| Payment | Due → Success or Failed; Success → Disputed → Dispute reversed if lost |
| Payment method | Pending → Active → Cancelled |

See [Payments and payment methods](/finance-and-accounting/integrations/ar-payments-api/payments-and-payment-methods/) for each state and the webhook
that signals it.

## Technical resources

Use these alongside the domain guide when building your integration:

- **Postman collection** — Example queries and mutations:
  <https://www.postman.com/lavanda/lavanda-external-api/overview>
- **Apollo explorer** — Full GQL documentation:
  <https://studio.apollographql.com/public/lavanda-1xwaoq/variant/production/home>
- **Webhook event catalogue** — Available events, payloads, and schemas:
  <https://webhooks-docs.lavanda.app/>
- **GraphQL endpoint** — <https://platapi.lavanda.app/v1>

## In this section

- [How it works](/finance-and-accounting/integrations/ar-payments-api/how-it-works/) — the sync model between Lavanda and your systems.
- [Staying up to date](/finance-and-accounting/integrations/ar-payments-api/staying-up-to-date/) — the webhook + AR API pattern in detail.
- [Payments and payment methods](/finance-and-accounting/integrations/ar-payments-api/payments-and-payment-methods/) — payment and mandate states,
  webhooks and example queries.
- [Open-balance check](/finance-and-accounting/integrations/ar-payments-api/open-balance-check/): whether a guest owes money, and how much, in each of
  an operator's workspaces.
- [What is available today](/finance-and-accounting/integrations/ar-payments-api/whats-available-today/) — current scope and what's coming.

Questions about access or rollout? Contact your Lavanda representative.
