This guide will walk you through the steps for integrating Xero accounting Software with Zoho Creator applications. I have decided to split this guide into multiple parts. You can expect the next part soon.
- A hosting account -> php based.
- Basic knowledge of understanding php code and XML
- Basic knowledge of posturl task in Zoho Creator
Xero requires OAuth for authentication. So, a simple URL request with a client ID or secret code does not allow you to integrate Zoho Creator with Xero application. It also requires certificate files and validate through xero php classes.
We looked at the php library for Xero, written by Xero team and wanted to make use of it. Also, everyone at our company understands php and Zoho Creator. So, we thought we will pick this one. They also have libraries for other languages, if you don’t want to use php. But, this article assumes you are using the php library.
1. Download the copy of Xero PHP API library
Download the Php API library for Xero from https://github.com/XeroAPI/XeroOAuth-PHP and unzip it.
2. Working with the downloaded library
- After downloading the file, you can unzip it to the Xero folder
- If you have a hosting account and if you can edit the files online, upload the xero folder to your hosting server
- If you want to test it in your localhost, you can move the xero folder to your localhost path
- Once it is done, you can verify if it is uploaded correctly by accessing your xero path from your server (localhost/hosted)
3. Understanding the downloaded Library
The Php library you just downloaded has 3 folders(directories) and a few files. We will go through the folders and private.php file in this guide.
This folder holds the private certificates you will generate for the purpose of using this api. According to Xero,
Private and Partner applications must sign messages using the OAuth RSA-SHA1 method.
This requires that you create a public/private key-pair, and upload the public certificate during application registration. We refer to this certificate as an application certificate.
To get started with creating a public/private key-pair we recommend the use of OpenSSL
For the steps to create self-signed certificates, visit https://developer.xero.com/documentation/api-guides/create-publicprivate-key/
After you are done with creating certificates (privatekey.pem and publickey.cer files), upload them to the certs folder. These files are important as Xero will check for the certificates while making the api connection
This folder contains php classes that connect with Xero server at different times and authenticate the user
The tests.php file in this folder has sample requests for all the Xero APIs. You can use the code from this file, instead of writing your own code while pushing data to Xero.
As soon as you create a new Private application from Xero (it’s free and easy, steps at https://developer.xero.com/documentation/auth-and-limits/private-applications/), you will find the consumer_key and shared_secret on the application page. Copy them and paste them in the private.php file. Like below
$signatures = array (
'consumer_key' => "Your Consumer Key",
'shared_secret' => "Your Shared Secret",
// API versions
'core_version' => '2.0',
'payroll_version' => '1.0',
'file_version' => '1.0'
4. Testing the Xero Connection
To be continued in part 2…