Use case 01 · Invoice sync

Send your product’s invoices into your customers’ books

When your product bills an order or a subscription, AccountingKit writes the invoice into the accounting system that customer already uses and tells you when it is paid. One request shape covers all six systems, and the connection decides the provider. Every write is idempotent, so a retry never creates a second invoice.

Facts checked

How it works

  1. Connect

    Your customer connects their accounting system

    Create a connect session and send the customer to the hosted flow. They authorize and pick their organization, and you receive connection.created with the connection ID.

    POST /v1/connect-sessions
  2. Match

    Find or create the contact

    Search the customer’s ledger for the contact you are billing, or create it. Contact writes work on all six systems.

    POST /v1/connections/{id}/contacts/search
  3. Write

    Create the invoice

    Send the invoice with your own order ID as external_reference and an Idempotency-Key. The response is the normalized invoice, with the provider’s ID.

    POST /v1/connections/{id}/invoices
  4. Listen

    React when it is paid

    AccountingKit reads the live invoice after each provider change and sends you a signed event when the amount paid, amount due, or status moves.

    invoice.paid

Who builds this

  • Billing and subscription products that issue invoices on a schedule.
  • Vertical SaaS for field service, bookings, or practice management, where a completed job becomes an invoice.
  • Marketplaces and order platforms that invoice on behalf of the businesses using them.

The request

The same body works for every provider. A few systems need one extra identifier, set under provider_options: QuickBooks Online requires an item_id and Wave requires a product_id for invoice lines.

curl --request POST "https://api.accountingkit.dev/v1/connections/$CONNECTION_ID/invoices" \
  --header "Authorization: Bearer $ACCOUNTINGKIT_API_KEY" \
  --header "Idempotency-Key: invoice-order-10042" \
  --header "Content-Type: application/json" \
  --data '{
    "external_reference": "order_10042",
    "contact_id": "1f7c1e6c-1f9a-4b52-9f1e-2a4c6d8e0b31",
    "status": "DRAFT",
    "due_date": "2026-12-31",
    "line_items": [{"description": "Implementation", "quantity": 1, "unit_amount": 1200}]
  }'

Events you receive

Events are signed. Verify the AccountingKit-Signature header against the raw body before you parse it, and deduplicate on the event ID.

EventWhen it is sent
invoice.paidThe invoice moved from any unpaid state to paid.
invoice.payment_changedThe amount paid, amount due, or status differs from the last known state.
invoice.due_soonSent once when an unpaid invoice is within 3 days of its due date.
invoice.overdueSent once after the due date passes unpaid.

Coverage by accounting system

Xero, QuickBooks Online, FreshBooks, and Wave push changes through provider webhooks. NetSuite and Sage Intacct have no provider webhooks here, so their changes arrive through scheduled reconciliation.

CapabilityXeroQuickBooksNetSuiteSage IntacctFreshBooksWave
ContactsRead and writeRead and writeRead and writeRead and writeRead and writeRead and write
InvoicesRead and writeRead and writeRead and writeRead and writeRead and writeRead and write
Provider webhooksYesYesNot availableNot availableYesYes
Invoice PDFYesYesNot availableNot availableNot availableYes

When something goes wrong

Your request times out

Retry with the same Idempotency-Key. You get the original result back with Idempotent-Replayed: true, and the provider is not called twice.

The same key arrives with a different body

The API answers 409 CONFLICT instead of guessing which invoice you meant. Keys are kept for 30 days.

The provider rate limit is hit

You get 429 RATE_LIMITED with retry_after_seconds. The budget is per connection, so one busy customer cannot use up another customer’s allowance.

A provider webhook never arrives

Hourly invoice reconciliation compares live payment state and sends the same events, so a missed notification is caught on the next pass.

Limits to know first

  • This covers customer invoices. Supplier bills, expenses, and bank transactions are not part of the API.
  • Writes and synchronization need a cached connection. Zero-retention connections support live reads only, so they cannot create records or send payment and due-date events.
  • Each connection runs through an OAuth app you register with the provider, on every plan.

Common questions

Do I need a different payload for each accounting system?

No. The invoice body is the same for all six systems. Where a provider needs an identifier that has no equivalent elsewhere, you set it under provider_options for that provider. QuickBooks Online requires an item_id and Wave requires a product_id for invoice lines.

How do I find out that an invoice was paid?

Register a webhook endpoint for invoice.paid and invoice.payment_changed. AccountingKit reads the live invoice after each provider change and sends a signed event when the payment state moves. Hourly reconciliation sends the same events for anything a provider webhook missed.

What stops a retry from creating a duplicate invoice?

Every write requires an Idempotency-Key. Repeating a request with the same key returns the original result and marks it Idempotent-Replayed: true. A retry that arrives while the first request is still running is rejected instead of writing twice.

Can I fetch the invoice PDF the accounting system renders?

Yes on Xero, QuickBooks Online, and Wave, through the invoice.download_pdf provider action. Invoice events tell you when a cached PDF should be refreshed, because an invoice can change after it is issued.

Keep reading