Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
Plan: Xero + QBO outbound payment write-back (Phase G parity)
Date: 2026-08-14 Branch: feat/rillet Status: Implemented 2026-08-14 — Xero live-verified on sandbox (bill → PAID); QBO code-complete, payload VERIFY-flagged (no QBO sandbox)
Goal
A Carbon-born payment (e.g. a bill paid in Carbon) pushes to Xero/QBO — marking the bill PAID and posting the bank/AP GL effect — exactly as Rillet already does (Phase G). Today Xero/QBO payments are pull-only, so a Carbon payment's GL never reaches them.
The push engine is already generic (PaymentSyncerBase.pushToAccounting, the
reconcilePayment decision core, fan-out, origin/loop-guard, mapping link with
origin:"carbon", the payment event trigger, ledger + drain). Only Rillet flips the
switches. Parity = per-provider adapter + un-hardcode two Rillet-only gates.
Carry over Rillet's v1 limits (enforced in the shared base): single-settlement,
base-currency (exchangeRate === 1), no discount/write-off, no void-echo (voided
Carbon payments Skip with a manual-remediation message).
Edit sites (from the investigation)
Shared (un-hardcode the Rillet-only gates)
-
packages/jobs/src/inngest/functions/integrations/reconcile-executor.ts:355—providerSupportsPaymentPush: args.providerId === "rillet"→ true for rillet/xero/quickbooks (derive from a provider capability, not a string literal). -
packages/jobs/src/inngest/functions/integrations/accounting-outbound-sweep.ts:274-291— page posted payments as candidate refs for Xero/QBO too (critical for Xero: the outbound sweep is its only periodic drain).
Subscriptions
-
packages/ee/src/accounting/core/subscriptions.ts— add{ table: "payment", operations: ["INSERT","UPDATE"] }to the Xero and QBOREQUIRED_SYNC_SUBSCRIPTIONSarrays. (Invariant test already satisfied — payment→payment maps and both have a payment syncer.)
Xero (providers/xero/)
-
provider.ts— movepaymentfromXERO_PULL_ONLY_ENTITIESto a newXERO_TWO_WAY_ENTITIES = ["payment"]forceddirection:"two-way",owner:"accounting",enabled:trueinbuildXeroSyncConfig(mirror Rillet'sRILLET_TWO_WAY_ENTITIES). -
provider.ts— addcreatePayment(payload)→request("PUT","/Payments",{body}); returnPayments[0].PaymentID. -
entities/payment.ts—supportsPaymentPush = true; remove thedirection === "push"rejection inshouldSync; implementpushRemotePayment(mirror Rilletpayment.ts:375-443): resolve doc remote id via mapping (invoicefor AR /billfor AP), resolve bank code vialoadAccountCodesById, bank-type pre-check (fail UNMAPPED_ACCOUNTS if the mapped Xero account is not BANK/EnablePaymentsToAccount), build{ Payments:[{ Invoice:{InvoiceID}, Account:{Code|AccountID}, Amount, Date }] }, callcreatePayment, return{ remoteId, compositeEntityId }viagetXeroPaymentSyncEntityId/getXeroBillPaymentSyncEntityId.
QBO (providers/quickbooks-online/)
-
provider.ts—paymenttwo-way (as Xero); addcreateBillPayment/createPaymentvia the genericwriteEntity(...). -
entities/payment.ts—supportsPaymentPush = true; remove push rejection; implementpushRemotePayment: APBillPayment{ VendorRef, TotalAmt, TxnDate, PayType, CheckPayment:{ BankAccountRef }, Line:[{ Amount, LinkedTxn:[{ TxnId, TxnType:"Bill" }] }] }; ARPayment{ CustomerRef, TotalAmt, TxnDate, DepositToAccountRef, Line:[{ Amount, LinkedTxn:[{ TxnId, TxnType:"Invoice" }] }] }. UsegetQbo*PaymentSyncEntityIdbuilders +loadQboAccountRefsById.
Tests
- Provider
provider.test.ts:paymenttwo-way (direction/enabled) for Xero + QBO. -
subscriptionsinvariant test stays green; add payment-subscription assertions. - Payment-syncer tests: Xero/QBO
pushRemotePaymentbuilds the right payload; bank-type pre-check warns; pull-side loop-guard still skips a mapped (provider-known) payment.
VERIFY on the live Xero sandbox (before trusting the push path)
- Xero create verb/body:
PUTvsPOST /Payments;AccountbyAccountIDvsCode. - Xero rejects a non-BANK payment account → confirm the error, keep the pre-check.
- QBO
BillPaymentrequiredPayType+ bank sub-object;Payment.DepositToAccountRef.
Verify (gates)
pnpm exec turbo run typecheck --filter=@carbon/ee --filter=@carbon/jobs
pnpm --filter @carbon/ee test && pnpm --filter @carbon/jobs test
Then a live Xero sandbox round-trip: post a Carbon payment against a synced bill, confirm the Xero bill flips to PAID and a Xero Payment exists.