Border7 FreshBooks Integration

FreshBooks Integration so invoices can be imported automatically

FreshBooks is an online accounting and invoicing service.  It excels at keeping things simple and easy for new users to create an account, invoice clients, and manage expenses.  If you are moving over from another system, or would like to have your previous records moved into FreshBooks, it offers an import for clients and expenses, but not invoices.  One of our clients needed to have their invoices for the beginning of the year moved over for accurate reporting; however, with hundreds of invoices already in FreshBooks, entering them all by hand would have been impractical.  In addition, they had a small online store where customers were ordering products, so there was a constant stream of new information.  FreshBooks is mainly for service based customers, so there is not a clean way to bring in those records.  So, what we did was leverage the FreshBooks API in order to create a custom import for the client’s previous invoices, as well as a running feed to their online store to record sales into FreshBooks.

Importing Invoices

FreshBooks has a standard API in which you can call, create, and update information in your account.  It is pretty straight forward, and for this project we needed to build the procedure for invoices.  We would need to organize the past invoices into a spreadsheet, write to the API to create each of the invoices, and then also create payments for each of the invoices, or else they would be seen as unpaid within FreshBooks.  The clients that each invoice was assigned to was imported beforehand, via the CSV import built into FreshBooks.  From there we were able to associate the client ID into our CSV file, from which our solution would API into the account.

There are several wrappers and libraries available to help with getting started on the FreshBooks API.  Our client’s server was Linux based, so we used a PHP wrapper to create the API into his account.  The API combined with a simple CSV parser was able to read the data from old invoices, and import them with client, date, amount, and payment information.

Creating the E-commerce Daily Import

Since we needed to also record our client’s sales from his online store as income, we decided to create a single client within FreshBooks known as “Online Stores.”  This way, we can attribute all of the sales from the store as invoices to this client.  Half the work is already done at this point, because we have the means to create invoices and log payments.  So, the only next step was accessing his online store’s API.  This particular client used Celery, which offered a straight forward API, and we were able to obtain all of the data we needed.  We created a script that would run daily, and pull all of the new orders, convert the data, and import them into FreshBooks to “Online Store” client, as well as log payment.

In the end, the client was able to have all of his previous invoices recorded, and his sales from his online store logged. Now he can see his financial situation on a daily basis without having to do any manual work.

Interested in starting a project, or have a question for the Border7 Team?  Contact Us, we’d love to hear from you! 

Share on: