Xero
Syncing contacts, invoices, credit notes, and payments with Xero accounting
The Xero integration keeps your accounting data in sync by pushing contacts, invoices, and credit notes from ServiceCortex to Xero. Payment status is pulled back from Xero on a schedule so your CRM always reflects the latest payment state.
Connecting Xero
You need Owner or Admin role to connect the integration.
- Go to Settings > Integrations > Xero.
- Click Connect to Xero.
- You are redirected to Xero to authorize ServiceCortex.
- Select the Xero organisation you want to connect (the first organisation is used if you have multiple).
- After authorization, you are redirected back to ServiceCortex.
The integration stores an OAuth2 refresh token that is automatically refreshed before it expires. A monthly keep-alive job runs on the 1st of each month to prevent token expiry due to inactivity.
Integration status
| Status | Description |
|---|---|
| Active | Connected and syncing normally |
| Pending | OAuth flow started but not yet completed |
| Token Expired | Refresh token has expired -- reconnection required |
| Error | A sync error occurred -- check the sync logs for details |
| Disconnected | Integration has been manually disconnected |
View your current status, connected Xero organisation name, and last sync time from the Xero settings page.
Contact sync
When you send an invoice for a client, ServiceCortex automatically syncs that client to Xero as a contact. The sync maps the following fields:
- Client name and company name
- Billing address
- Primary contact (first name, last name, email, phone)
- VAT number and company number
Automatic matching
When syncing, ServiceCortex first checks if a matching contact already exists in Xero using the contact number field. If no match is found, a new contact is created. You can also run Reconciliation from the Xero settings page to batch-match existing clients with Xero contacts.
Manual linking
If automatic matching picks the wrong contact or cannot find a match:
- Open the client detail page.
- In the Xero section, click Search Xero Contacts.
- Find the correct contact and click Link.
To unlink a client from a Xero contact, click Unlink on the client detail page. This clears the mapping without deleting the contact in Xero.
Invoice sync
Invoices are synced to Xero when they are sent. The sync creates or updates an invoice in Xero with matching line items, amounts, tax rates, and due dates.
Key behaviors:
- Each invoice is synced exactly once using an idempotency key to prevent duplicates.
- If the linked Xero contact does not exist yet, the client is synced first automatically.
- Invoice numbers and amounts are preserved in the mapping for cross-reference.
- You can manually trigger a sync for any individual invoice or use Sync All to push all sent invoices.
Invoice status in Xero
The Xero invoice status is tracked alongside the ServiceCortex status:
| Xero Status | Description |
|---|---|
| DRAFT | Invoice created in Xero but not yet authorised |
| AUTHORISED | Invoice approved and awaiting payment |
| PAID | Full payment received |
| VOIDED | Invoice voided in Xero |
| DELETED | Invoice deleted in Xero |
If an invoice is deleted or voided in Xero, ServiceCortex detects this during the next sync cycle and marks the mapping accordingly. You can re-sync a deleted invoice to create a fresh copy in Xero.
Credit note sync
Credit notes are synced to Xero using the same pattern as invoices. When a credit note is issued in ServiceCortex, it is pushed to Xero with the corresponding line items and linked to the correct contact.
Credit note allocations (applying a credit to an invoice) are also synced so that Xero's accounts receivable balances stay accurate.
Payment sync
Payment status is synced from Xero back to ServiceCortex on a scheduled basis:
- Every 15 minutes -- unpaid invoice mappings are checked for payment updates in Xero.
- When Xero reports an invoice as paid, the corresponding ServiceCortex invoice is updated.
- Payment records reconciled in Xero (such as bank transfers) are imported as local payment records.
This means that even if a customer pays via bank transfer and you reconcile it in Xero, the payment status automatically flows back to ServiceCortex.
Sync logs
Every sync operation is logged with the operation type, entity, status, and duration. View sync logs from Settings > Integrations > Xero > Sync Logs.
Logs are retained for 30 days and then automatically cleaned up.
Retry and error handling
Failed syncs are retried automatically with exponential backoff:
| Retry | Delay |
|---|---|
| 1st | 5 minutes |
| 2nd | 15 minutes |
| 3rd | 45 minutes |
| 4th | 135 minutes |
| 5th | 405 minutes |
After 5 failed attempts, the sync is marked as Skipped and stops retrying. An hourly health check monitors accounts with skipped items and logs alerts. If an account accumulates 5 or more permanently failed items, a warning is recorded on the integration.
Xero account mapping
For advanced accounting workflows, you can configure which Xero accounts are used for specific transaction types:
| Setting | Purpose |
|---|---|
| Default Account Code | Revenue account for invoice line items (default: 200) |
| Stripe Bank Account Code | Bank account where Stripe payouts land |
| Stripe Fee Account Code | Expense account for Stripe transaction fees |
| Stripe Surcharge Account Code | Income account for customer surcharges |
| Gift Card Account Code | Account for gift card redemption payments |
These are configured in Settings > Billing > Payment Settings.
Disconnecting Xero
- Go to Settings > Integrations > Xero.
- Click Disconnect.
- The integration is marked as disconnected and all syncing stops.
Existing mappings are preserved so that if you reconnect, previously synced items are not duplicated.
Troubleshooting
| Issue | Resolution |
|---|---|
| Token Expired | Go to Settings > Integrations > Xero and click Reconnect to re-authorize |
| Invoice sync failed | Check the sync log for the error message. Common causes: missing contact mapping, invalid tax rate, or Xero API rate limit |
| Contact matched to wrong Xero contact | Unlink the client and manually link to the correct Xero contact |
| Duplicate invoices in Xero | This should not happen due to idempotency keys. If it does, void the duplicate in Xero and re-sync from ServiceCortex |
What's next
- Set up Stripe for online payment processing.
- Manage invoices that sync to Xero.
- Configure email templates for invoice notifications.