xero
Xero is a suite of online accounting software for small businesses, accountants, and bookkeepers.
| Read | Create | Update | Delete | Webhook | ||
|---|---|---|---|---|---|---|
| Accounts | ||||||
| Async task | ||||||
| Bank accounts | ||||||
| Bills | ||||||
| Bill lines | ||||||
| Booking proposals | ||||||
| Contacts | ||||||
| Customers | ||||||
| Credit notes | ||||||
| Dimensions | ||||||
| Expenses | ||||||
| Files | ||||||
| Goods receipts | ||||||
| Goods receipt lines | ||||||
| Invoices | ||||||
| Invoice lines | ||||||
| Items | ||||||
| Journals | ||||||
| Journal entries | ||||||
| Offers | ||||||
| Offer lines | ||||||
| Open items | ||||||
| Payments | ||||||
| Payment terms | ||||||
| Projects | ||||||
| Purchase orders | ||||||
| Purchase order lines | ||||||
| Sales orders | ||||||
| Sales order lines | ||||||
| Suppliers | ||||||
| Tax rates | ||||||
| Transactions | ||||||
| Trial balance | ||||||
| Units | ||||||
| Users | ||||||
| Vendor credits |
= Not supported by Maesn at this time
= Not supported by Xero
How to connect to Xero
To allow your customers to link your application with their Xero accounts, you need to set up a Xero App and submit your application credentials to maesn.1
Prerequisites
Before you begin, make sure you have the following:
- A Xero account with administrator permissions.
2
Create the Xero App
In this step we create the App that a user can choose to install into their Xero instance to authorize the integration with your application.
- Navigate to the Xero developer portal and log in, if you are not already logged in.
- On the tab “my Apps”, click “New App”.
- In the pop-up, enter the below details:
- App Name: This should be your application’s name. When your users link their Xero account, they will see that “App Name” is requesting to integrate with their Xero account.
- Integration Type: Web app.
- Company or application URL: The homepage of your company’s website, e.g. https://yourcompany.com/.
- Redirect URI: Should be set to https://api.maesn.dev/auth/callback/xero
3
Generate your client secret
Now it is time to generate the unique client secret for your App.
- Navigate to the Configuration tab of your newly created App
- Click the “Generate a secret” button.
- Note your
client id, which you will need together with theclient secretin subsequent steps. - Copy the
client secretby clicking the Copy button next to the value. Make sure that you have copied the value before navigating away from this page. Once navigating away, you will not be able to retrieve it again.
4
Configure your integration in the maesn API
In the last step, we setup your API tenant with your App’s details:
- Get in touch with your contact person at maesn to submit the client id and client secret.
Becoming a Xero Partner
Anyone can become a Xero app partner. The requirements and steps to become a partner are detailed here. Note that it is only possible to link 25 Xero accounts to your app before it is certified through the app partnership process. In addition, your customers cannot link more than two applications that are not certified.Webhooks
Xero supports the following resource types:CONTACTINVOICE
CREATED and UPDATED events.
In the case of Xero, webhooks are App-based. This means they must be created for a given app as described here.
To set this up, call Maesn’s create webhook endpoint POST /tenant/webhooks with the following body:
Example code snippet
eventType and resource parameters: you can select the resource types directly in the Xero App configuration, while the event types are predefined by Xero (see above).
Instead, you will need to provide the targetSystem parameter with the value xero.
It will return an id and url that can be used in your App’s configuration:
Example response
Wehbook key that needs to be sent to the POST /events/key/:code endpoint, where :code is the <code> from the url got in the previous response.
In the request body you need to provide the key in your Xero’s app:
Example code snippet
userId that can be used to identify the user:
Example event body
userId : this allows you to match each webhook event to the correct customer.