# Xero

To install the Xero integration, go to **Settings** -> **Integrations** -> **Available integrations** and select the Xero integration:

![](https://1350849115-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbI5ndB_5fDbdrLXs5c%2Fuploads%2FACuzfJUM5vKOhyrMob7P%2Fimage.png?alt=media\&token=85b75514-19f4-4d38-b74a-dd484aee1d44)&#x20;

Once added, the Xero integration configuration screen will appear:

<figure><img src="https://1350849115-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbI5ndB_5fDbdrLXs5c%2Fuploads%2FuKcGEKoKFh0Ff4sy7R8K%2Fimage.png?alt=media&#x26;token=1517843f-7fcf-461c-b7ed-3793ee1f379a" alt="" width="563"><figcaption></figcaption></figure>

1. Select the entity for which this integration is for. This controls which invoices or journal entries are synchronized. Click **Save**.
2. Click **Connect to** and the Xero integration authorization dialogue will appear:\
   \
   ![](https://1350849115-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbI5ndB_5fDbdrLXs5c%2Fuploads%2FmIjjGl9SmMKDT8ujOg5j%2Fimage.png?alt=media\&token=91f2a53c-250f-4420-a305-4d6e5ecc6dfc)<br>
3. Click **Allow access**. The window will close.&#x20;
4. On the Xero integration configuration page you have the option to select between two integration modes:
   1. **Automatically sync invoices...** which will push invoice and related customers to Xero as soon as invoices are generated (and released from Draft, if that is enabled) as well as the related customer.
   2. **Automatically sync journal entries...** which will push journal entries related to invoices, accounts receivable, payments, taxes etc. to Xero as manual journals.\
      \
      See below for further explanation of these options.
5. Click **Save**. The integration is now active.

### Invoice synchronization

If enabled, invoices and their related customer will be pushed to Xero once the invoice leaves the `Draft` state and goes into either `Not due`, `Due` or `Paid` .

<figure><img src="https://1350849115-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbI5ndB_5fDbdrLXs5c%2Fuploads%2FEgPuzsPeT0DFHH0y8kDO%2Fimage.png?alt=media&#x26;token=7248a056-905b-4558-82f7-b7ba1ca72267" alt=""><figcaption></figcaption></figure>

Invoices in Xero are created as draft invoices and will need to be approved to become final in Xero.&#x20;

### Journal entry synchronization

Journal entries are generated when one of the following events happen:

* An invoice is created.
* A payment is received.
* A credit note is created.&#x20;
* A payment is applied to an invoice.

When doing this, Bunny looks for the default financial accounts for e.g. accounts receivable, clearing account, deferred revenue, earned revenue etc. By default, Bunny comes with a set of financial accounts, and before journal entries can be synchronized to Xero, these mappings need to reconfigured.&#x20;

The following configuration steps must be completed:

1. On the Xero integration configuration page, click **Update accounts**. This will import the chart of accounts from Xero into Bunny.&#x20;
2. Next, go to **Billing** -> **GL mappings**. For each of the account types listed below, select the corresponding financial account imported from Xero, and set the account type attribute to the correct account type. Additionally, mark the account as default for that account type. \
   \
   As an example, the account type **Accounts receivable** must be set on the financial account "1200 - Accounts receivable" which was imported from Xero:\ <br>

   <figure><img src="https://1350849115-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbI5ndB_5fDbdrLXs5c%2Fuploads%2FpJhziNEzV0opC8f3NkIi%2Fimage.png?alt=media&#x26;token=02cba748-8814-4678-9f55-b930fec1b2c7" alt="" width="563"><figcaption></figcaption></figure>

   \
   Perform these steps for each of the following account types:<br>

   1. Earned revenue
   2. Deferred revenue
   3. Accounts receivable
   4. CP/CA
   5. Tax payable
   6. Conversion gain
   7. Conversion loss
   8. Banking fees
   9. Payments
   10. Bad debt<br>
3. Once all the above account types have been assigned to financial accounts imported from Xero, the integration can be enabled. Go to the Xero integration configuration page, and enable the **Automatically sync journal entries to Xero** setting and click Save.&#x20;
