Skip to content
Docs menu

Finance connections to QuickBooks Online

Connect an entity to its QuickBooks Online company and Finance posts the entity's ready journals there as journal entries, each once, with nothing sent until someone connects and one accounting system per entity.

View .md

QuickBooks Online is the second accounting system Finance can connect to by API, after Xero. It works the same way: files come first (export files make no outbound call), and a connection is the optional second way. Once an owner, admin or controller connects an entity to its QuickBooks Online company, Finance posts the entity's ready journals there as journal entries, each one once. Nothing is sent to QuickBooks until someone connects, and disconnecting deletes the connection's tokens.

Connections live in Finance > Connectors > Connections (/finance/connectors?tab=connections), with the Connectors module (finance.connectors). With the module off, the page, the tools and the REST routes answer 403 product_not_enabled.

One accounting system per entity

An entity posts to one accounting system at a time, so a journal can never reach two. While an entity's Xero connection is active or needs reconnecting, Connect QuickBooks Online does not appear for it and the connect link is refused with a message; the same holds the other way round. To move an entity from one system to the other, disconnect the first, then connect the second. The database enforces the rule as well, so two consents finishing at the same time cannot both win.

Different entities of one organisation can use different systems: each legal entity keeps its own books.

Before you start: QuickBooks on this install

QuickBooks needs an app registered by whoever runs the install, at developer.intuit.com, with the QuickBooks Online Accounting scope and the redirect URI https://<your cloud>/api/workspace/finance/connections/callback. The operator sets its credentials as environment variables:

Variable What
QBO_CLIENT_ID the app's client id
QBO_CLIENT_SECRET the app's client secret
QBO_ENVIRONMENT production (the default) or sandbox, for an app's development keys and Intuit's sandbox companies

With either credential unset, QuickBooks is not configured on the install: the Connect QuickBooks Online button does not appear, the tools say so, and nothing calls Intuit. The install also needs its vault key (VENOM_VAULT_KEYS) to keep the tokens. A connection remembers the environment it was made in, so changing QBO_ENVIRONMENT later does not move an existing connection to the other host.

Connect an entity

On the Connections tab, each entity you may connect has Connect QuickBooks Online. You need reference.write on the entity: a controller there, or an owner or admin. Agents never connect, and no tool does.

  1. Finance sends your browser to Intuit's consent screen with a one-time state tied to you and your organisation, good for ten minutes. Finance asks for the com.intuit.quickbooks.accounting scope only. Intuit's documentation does not offer PKCE for this flow, so none is sent; the single-use state bound to you protects the consent.
  2. You pick the QuickBooks company and approve.
  3. Intuit sends you back with the company's id (its realm id). The state is used once. Finance reads the company's name and home currency, and seals the tokens in the vault, never shown, logged or returned by a tool.

The entity's functional currency must be the company's home currency: a journal in another currency is refused before anything is sent. Each journal line's account is matched by account number first, then by name, so either turn on account numbers in QuickBooks and use Finance's codes, or keep the names the same.

What is posted, and when

The sweep cron runs every minute. For each active connection it takes the entity's ready journals (and failed ones whose next try is due), oldest number first, at most 50 a run, and creates each as a QuickBooks journal entry:

  • debits and credits as lines with a positive amount and a posting type (Debit or Credit), in line order;
  • the journal's number as the entry's number (the first 21 characters), its date, and its memo as the private note.

QuickBooks has no draft journal: a created entry is posted at once. Each journal:

  • is posted at most once. Before any call Finance records the journal against the connection with an idempotency key, and sends a request id derived from it (QuickBooks' requestid). If QuickBooks made the entry but the answer never arrived, the next try sends the same request id and QuickBooks answers with the entry it already made.
  • is never posted while it is in an open export file, and never once it is posted.
  • once QuickBooks accepts it, is marked posted with external_ref quickbooks:<journal entry id>.

When a post fails, the journal is marked failed and one sync_failed exception goes on the exceptions queue:

Failure What happens
No answer, a network error, a 5xx tried again with the same request id after 1 minute, then 2, 4, 8 … up to 6 hours
QuickBooks refused the journal (a validation error, an inactive account, no matching account) not tried again until a person fixes it and retries the journal (finance_journal_retry)
QuickBooks' rate limit (429) nothing changes on the journal; the connection waits for Retry-After, or 60 seconds as Intuit advises
QuickBooks refused the tokens, even after a refresh the connection shows Needs reconnecting and posting stops until someone reconnects

Lines go without a tax code, a class or a department. QuickBooks requires a customer on an Accounts Receivable line and a vendor on an Accounts Payable line, and Finance does not send one yet. Finance checks this before it calls QuickBooks: a journal with a line on an account QuickBooks types as Accounts Receivable or Accounts Payable is not sent, is marked failed, and gets one sync_failed exception that says which accounts need a customer or a vendor. It is not tried again by itself. Post it through an export file, or move the line to another account and retry the journal. On the close checklist it is a journal whose sync failed, which does not block the lock.

Access tokens last an hour and are refreshed shortly before they expire, under a lock. QuickBooks rotates refresh tokens: every refresh returns a new one, and Finance stores it in place of the old one in the same step. A refresh token unused for 100 days expires; Finance then shows Needs reconnecting without calling Intuit.

Sync now (a person with journals.write on the entity, a controller) runs the connection at once and ignores the backoff, not the rate limit. The not-synced report and the recent runs read as they do for Xero.

Disconnect

Disconnect deletes the connection's tokens and revokes them at Intuit, and nothing more is posted. Journals already posted stay posted. It needs reference.write on the entity and the console or finance:admin. An agent never disconnects.

Tools and REST

The same tools as for Xero (finance_connection_list, _get, _sync, _disconnect, with REST twins under /api/v1/finance/connections). Each connection carries its system (xero or quickbooks) and system_name, and finance_connection_list says which systems are configured on this install (configured: {xero, quickbooks}). Connecting has no tool: GET /api/workspace/finance/connections/connect?entity_id=&system=quickbooks sends a signed-in person to Intuit and GET /api/workspace/finance/connections/callback brings them back.

Outbound hosts

A connection is an opt-in outbound integration (an exception to Petawork's no-outbound-call rule, named in CLAUDE.md). With no active connection, or with QuickBooks not configured on the install, Petawork Cloud makes no call to Intuit. With one, it calls only these hosts, over https, through the same guard as every other outbound call:

Host What for
appcenter.intuit.com the consent screen (your browser goes there, not the cloud)
oauth.platform.intuit.com /oauth2/v1/tokens/bearer (tokens and refresh)
developer.api.intuit.com /v2/oauth2/tokens/revoke (on disconnect)
quickbooks.api.intuit.com /v3/company/<realm id>/… (the company's name and currency, accounts, journal entries)
sandbox-quickbooks.api.intuit.com the same, for a sandbox company (QBO_ENVIRONMENT=sandbox)

Every API call names the company's realm id and minor version 75, the only one Intuit serves. Bills and payments are not posted yet.