Plugins
Templates

Xero Accounting Plugin

Link to plugin page: https://zeroqode.com/plugin/xero-accounting-1546872666890x498865460961869800

Introduction

Xero is a leading online accounting and reporting tool and this plugin allows to authenticate your app users with their Xero accounts and then read and write data.

Prerequisites

In order to interact with the plugin you'll need to get the API credentials client Key and client Secret. Create your development account at : https://developer.xero.com/

Check API Calls limits here - https://developer.xero.com/documentation/oauth2/limits

How to setup

I. Setup Xero Development application

  1. First you will want to head over to your Xero Developers Console,

  2. Create an account (or Login with existing) & Create a new 'Public App'.

Fill in the details of your company and the redirect URI , accept Xero's TOS and Create the App.

Note: Make sure to copy and paste your secret immediately. You won't be able to see it again.

3. Once done you will have the required 'Consumer Key' (Client ID) & 'Consumer Secret' (Client Secret) to provide in the Xero bubble plugin settings.

II. Setup Xero plugin on Bubble side

  1. In your Bubble app, select the data tab and then open the 'User' data tab. We need to add a few fields here so that the authorization process is easier to manage. The fields are case sensitive & need to be created exactly as shown below including the type of field:

2. Add the Client Secret and Client ID alongside the redirect uri which you've set in Xero app dashboard to the Plugin Settings tab:

3. Create the authorization workflow by placing Plugin Element Connect Xero Button Oauth 2.0 on page editor

4. The workflow to complete the authorization between user & Xero is fairly easy , set an event when url contains token from Xero add action Get Xero Token From URL Oauth 2.0 and this action it is necessary only get value from page url .

5. To get the user information use action Get user from token Oauth 2.0 which will return Email, Given Name, Family Name. And in order to retrieve these values provide the Token ID from previous step

Plugin Element Proprieties

The plugin contains Connect XeroButtonOauth 2 visual element which should be used on page.

Xero OAuth1 - Deprecated Connect Xero Button - Deprecated

Note: Please use the update Oauth 2.0 element and actions with plugin.

Plugin Data/Action Calls

Data Calls

Xero () - Get Bank Transactions: Use this method to retrieve one or many bank transactions Xero () - Get Bank Transfers: Allows you to retrieve any bank transfers Xero () - Get Batch Payments: Use this method to retrieve batch payments Xero () - Get Invoice Reminders: Use this method to check if invoice reminders are enabled. Xero () - Get Invoices: Use this method to retrieve one or many invoices Xero () - Get Repeating Invoices: Use this method to retrieve either one or many repeating invoices Xero () - Get Organisation: Returns information about a Xero organisation Xero () - Get Employee: Use this method to retrieve one employee Xero () - Get Employees: Use this method to retrieve one or many employees Xero () - New Get Payments: Use this method to retrieve either one or many payments for invoices and credit notes Xero () - New GET Items: Use this method to retrieve either one or many items Xero () - New Get Tracking Categories: Elements for Tracking Categories Xero () - New Get Users: Returns the users for a Xero organisation Xero () - New Get Accounts: Allows you to retrieve the full chart of accounts

Action Calls

Xero () - Get Tenants Id: method retrieves tenant id Xero () - Update Accounts: Use this method to update account details. Xero () - DELETE Accounts: Non-system accounts and accounts not used on transactions can be deleted using the delete method. Xero () - ADD Employee: Use this method to create one or more employee records

Plugin Actions

1. Remove OAuth URL Parameters - is used to remove additional oauth parameters from url 2. Create/Edit Xero Data - used to create or edit xero data 3. Get Xero Token From URL Oauth 2.0 - used to create xero token obtained from xero 4. Get user from token Oauth 2.0 - is used to obtain user data from Xero Token 5. Refresh Token - This action is used to obtain refresh token

Workflow example

In this workflow we will show you how to retrieve and display, Accounts , Employees and Users values on Bubble via action when a Button is clicked.

  1. Place an element Button on page

2. Add an action on button clicked , Refresh Token

3. Next we make changes to user fields

4. In last step we save the values in custom states retrieved from Xero

5. The retrieved values on front-end, (ex Accounts and Users)

Changelogs

Update 17.11.20 -

  • Migrated plugin from Oauth 1.0 to Oauth 2.0 authorization

Demo to preview the settings