# Xero

> Connect Xero with OAuth 2.0, pull contacts and invoices into Alya Books, and push issued e-invoices to Xero.

Source: /help/en/integrations/xero

The Xero connector links a Xero organisation to Alya Books. It pulls contacts and sales invoices into Alya Books and can push invoices that Alya Books has issued into Xero as authorised invoices. Only owners and admins can connect and sync.

## Connect

1. Go to **Connectors** and click **Connect Xero**.
2. Choose **Live account** and click **Continue to Xero**. Sign in, pick the organisation and allow access. You return to Alya Books with the connector *connected*.
3. Click **Configure**: pull contacts, pull invoices, push issued invoices, push-from date, the sales account code (for example `200`) and the Xero tax types to use for standard, zero-rated and exempt lines (`OUTPUT`, `ZERORATEDOUTPUT`, `EXEMPTOUTPUT` by default).

**Sandbox (simulated)** runs the same flow with sample data and never contacts Xero.

## Sync

**Sync** on the card offers *changes since the last sync*, *everything* or *invoices in a date range*, with switches for pulling contacts, pulling invoices and pushing.

- Contacts are matched by TRN, then by name; linked contacts are updated on later runs.
- Invoices arrive as **drafts** with the Xero number, contact, lines and VAT. Check the buyer TRN and VAT category, then validate and submit. Invoices already in Alya Books are skipped.
- Pushed invoices are created once; Alya Books keeps the link and shows the Xero id (or the error) per invoice in the result.

**Test** verifies the connection and refreshes the token. Connectors set to *daily* are also synced by the daily job.

## Related

- [QuickBooks Online](/help/en/integrations/quickbooks-online)
- [Odoo](/help/en/integrations/odoo)
- [Accounting exports](/help/en/integrations/accounting-exports)
