Skip to content

kenwest/nz.co.fuzion.civixero

 
 

Repository files navigation

nz.co.fuzion.civixero

Synchronisation CiviCRM and Xero for financial transactions and contacts.

This extension requires the AccountSync extension.

It sets up scheduled jobs that synchronize Xero contacts and invoices with CiviCRM contacts and invoices.

Interaction with this module is primarily by API and it creates scheduled jobs to run those API.

Setup extensions

In the server in the sites, extensions folder in a terminal window you can run the command

git clone https://github.com/eileenmcnaughton/nz.co.fuzion.civixero.git

and the same for AccountSync

git clone https://github.com/eileenmcnaughton/nz.co.fuzion.accountsync.git

then you will have the extensions added to the site.

To use these extensions on the site, on the CiviCRM menu on the site go to administer - customise data and screens - manage extensions. There you should install CiviXero and AccountSync.

Setup XERO OAuth 2.0

You will need to have set up an company/organisation and an OAuth 2.0 App with XERO.

Company/Organization

For testing purposes, you can use the Xero Demo Company

Create Xero App

Before creating the app, it will help to be logged into CiviCRM as well as Xero.

Go to https://developer.xero.com/

On the menu, click on MyApps, then click New app.

Use the following details:

  • Company or application URL: https://YOUR-SITE-URL
  • OAuth 2.0 redirect URI: this needs to exactly match the url you get when you navigate to Administer -> Xero -> Xero Authorize. Xero validates it against this url. Note - if you are working in a local dev environment the url will not be accepted if it does not use localhost as the domain.

After the app is created, click the button to generate a Client Secret. Copy the Client ID and the Client Secret, you will need them later.

Setup in CiviCRM

CiviXero Settings

You then need to add the Client ID and Client Secret in the Xero Settings page in CiviCRM (Administer>Xero>Xero Settings)

Xero Settings

On this page you should also define which edit and create actions should trigger contacts / invoices to be created / edited in Xero

(Due to current CiviCRM bug, disable and re-enable CiviCRM logging if you are using db logging)

Authorizing with Xero

Next, authorize the app to access your Xero Company data. In CiviCRM, go to (Administer>Xero>Xero Authorize). Click the button to Authorize. You will be prompted for your Xero credentials and then further prompted to grant the app various permissions. You should then be returned to the Authorize page. The page will show a status to indicate it has successfully connected to Xero.

Set up Synchronization

Once authorized you interact with CiviXero via the scheduled jobs page and the api. Matched contacts should show links on their contact summary screen and matched contributions should show links on the invoices

CiviCRM tracks synchronisation in the civicrm_account_contact table - to populate this from xero run the api command civixero contactpull with a start_date - e.g '1 year ago'

e.g drush cvapi civixero.contactpull start_date=0

Customisation & Additional Extensions

To modify the behaviour of the CiviXero extension various hooks are available. The additional CiviCRM extensions are available:

Xero Tweaks

  • Removes the Contact ID from their Xero name.
  • Includes additional address lines in the contact address.
  • Removes the Contact's name from the Invoice Reference and Line items.

Xero Untax

  • Remove tax details from line items sent via CiviXero, so Xero can figure it out avoiding rounding issues.

Xero Items

About

Synchronisation between CiviCRM & Xero

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 94.1%
  • Smarty 4.8%
  • Other 1.1%