Clear Books offers an API, along with full details and simple examples using the PHP SoapClient (you can also communicate via XML if you please). And to my surprise it was very simple to use.

In a nutshell the API can be used for:

  • Adding sales and purchase invoices to the system
  • Recording  payments and allocating them to invoices
  • Adding customers and suppliers
  • Updating customer and supplier information

A small example so you can see what I mean

When you order an SSL certificate you go through a simple sign up system where you have to input the required information.

Unbeknown to you as a customer several things happen when you click on that continue button (none of then bad I assure you!). One of those things is to set you up in Clear Books and register your order. This sort of thing just isn’t available without an API and most definitely not on desktop based software.

Clear Book create entity file is included in main order script:

Content of create entity file:

You can see how easy it is to update the example code given – just add your information where needed. You can see I’ve left some the of the values hard coded as I have no reason for any more flexibility.

Content of ClearBooks config file:

You can get your apiKey from the settings tab when you have logged in to your Clear Books account. It’s way down bottom right and looks like this:

And in the words of a celeb chef … “done”.  That’s it. If you place an order it appears straight away in Clear Books. And when you pay for that order the corresponding transaction is also sent to Clear Books via the API.

Why is this so good? Simply it means my accounting is done for me. I don’t need to worry about inputting your details separately, or registering the order, the payment from you to Donkey Internet, the payment from Donkey Internet to the Certificate Authority, the payment gateway transaction and fees, manually. It is all done using 3 simple PHP includes and the simple SoapClient API from Clear Books.

Apart from when payments are received I’ve had to make very few changes to the provided examples on the Clear Book site. The reason the payments one has been a bit more complicated is because I have had to factor in gateway charges/percentages so have to do some custom coding before submitting to the API. In essence what is provided by Clear Books is still used, I just do some extra stuff before calling it. (Note: there is no update payment example but the concept is the same as those provided).

What’s more there is no extra charge for using the API! I asked Clear Books before writing this post if there were any new API calls coming out I could allude to but when I think about it I’m not sure there really need to be any more. At the end of the day accounts software exists to record transaction of all types in and out and for me that needs to be quick, simple and automated as much as possible!

David Eaton

Posted by David Eaton

David is a Chartered Accountant and Director of SME Strategies (smestrategies.co.uk) which offers tailored support to ambitious SMEs and gives mentoring to owner managers.

Leave a reply

Your email address will not be published. Required fields are marked *