SOQ International Academy

Xero Finance Sync

Xero Finance Sync

Package soq-sg-xero · permissions 90160–90164

Xero Finance Sync

What this screen is

Sends TMS sales to Xero automatically: contact, invoice, optional payment, optional organization bill, and refund credit notes. Checkout does not call Xero directly; it queues rows so learner payment is not blocked by Xero downtime or missing mappings.

What you see
  • Connection & mapping (/admin/xero): Client ID, encrypted Client secret, Connect / Disconnect, sync switch, sync date, account and tax mapping.
  • Sync log (/admin/xero/logs): Pending / Synced / Failed / Skipped rows, Xero document links, dry-run preview, Retry, Retry all failed and Sync now.
Field / control guide
Field / controlRequired?Operator guidance
Integration environmentYesChoose Live Xero API for real OAuth2 sync or Internal Mock Sandbox for local/UAT verification without real credentials. Strictly locked out on production.
Client ID / Client secretYes before live connectUse the Xero app credentials. The secret is stored encrypted; leave it blank later to keep the stored value. Not required in Mock mode.
Connect / ReconnectYesUse Xero Demo Company for UAT, then connect the live organisation at go-live.
Sync enabledYes for live syncTurn on only after revenue, tax and payment mappings are ready. When off, new paid sales do not create queue rows.
Sync sales fromYes for live syncGo-live date such as 2026-10-03. Sales before this date are never queued.
CurrencyUsually SGDKeep SGD for Singapore courses unless the accountant requires another currency.
Default revenue accountYesSelect a Xero income account such as Sales, Training Income, Course Revenue or account code 200.
Diploma / sale-type revenue accountsOptionalUse only when the accountant wants separate income accounts. Blank values fall back to the default revenue account.
GST tax typeRequired if GST sales existSelect the Xero output GST code, commonly Standard-Rated / GST on Income / OUTPUT2 in the demo company.
No-GST tax typeYesUse NONE / Tax Exempt unless the accountant gives another no-tax code.
Online gateway accountRequired if creating Stripe paymentsSelect a bank or clearing account such as Business Bank Account or Stripe Clearing.
Create payment switchesOptionalOn = invoice plus payment. Off = invoice only; accountant matches the bank feed manually.
Wallet / offline accountsOnly for those flowsMap wallet to a wallet liability or clearing account, and offline to the bank transfer account.
Organization billsOptionalTurn on only for organization seller payouts. Requires bill expense account and bill tax type.
Settings bagFor Live mode: Enter the Client ID and Client secret, click Connect to Xero, and select the organisation. For Mock Sandbox: Select Internal Mock Sandbox directly. on APP_KEY.
Accountant Guide: Operating the Internal Mock Sandbox (Sprint 4)

For staging environments, UAT verification, and accountant training without requiring real Xero OAuth2 credentials or affecting live financial books:

  1. Navigate to Admin → Financial → Xero (/admin/xero).
  2. At the top of the Connection & mapping card, locate the Integration environment selector.
  3. Switch from Live Xero API to Internal Mock Sandbox.
  4. The system immediately bypasses OAuth token expiration checks and initializes the mock connection as SOQ International Academy (Mock Sandbox).
  5. The account mapping dropdowns are automatically populated with a standard Singapore Chart of Accounts:
    • Revenue Accounts: 200 - Sales Revenue, 205 - Course Fee Revenue, 260 - Other Income.
    • Bank Accounts: 400 - Operating Bank Account (SGD), 405 - Online Clearing (Stripe), 800 - TMS Wallet Liability.
    • Tax Rates (IRAS): Standard-Rated (9% GST), Zero-Rated (0%), Tax Exempt (NONE, 0%).
  6. Configure the mapping rules and click Save mapping.
  7. Create or simulate test purchases on the storefront.
  8. Navigate to Sync log (/admin/xero/logs) and click Dry-run or Sync now. The sync runner generates simulated invoices (e.g. INV-MOCK-XXXXX) with audit payloads.
  9. Production Safety Guard: Mock Sandbox mode is strictly locked out in production environments (!app()->environment('production')), enforcing real OAuth2 credentials for live financial operations.
How to complete the task
  1. Enter the Client ID and Client secret, click Connect to Xero, and select the organisation.
  2. Save the minimum mapping: sync date, default revenue account, GST / no-GST tax types, and Stripe payment account or payment creation off.
  3. Pay for a new course order after sync is enabled. Orders paid earlier are not backfilled automatically.
  4. Wait at least 60 seconds, open /admin/xero/logs, preview the invoice payload, then click Sync now or run php artisan soq:xero-sync --limit=50.
  5. If a row fails, read the error, fix the mapping, and click Retry. Synced rows include a link to the Xero document.

Notes / pitfalls: Sync now only processes rows already present in xero_sync_records; it does not create missing rows for old sales. Production needs the scheduler so soq:xero-sync runs every 5 minutes. The module never pays money out; accountants still pay organization bills and record refund payments in Xero.