Invoicing is one of the most important and complex parts of almost any application that allows its users to perform payments.
With all the numbers, taxes, fields, rules, and equations it can give a developer quite a headache. Fortunately, many solutions for invoicing exist and lucky for us, many of them are available in Rails.
Let’s take a look at some of the ways we can implement invoicing in our Ruby on Rails app.
To present every solution as objectively as possible I’ll use the same set of criteria and score them from one to five points in each category:
Ease of use: how easy it is to use and implement the solution
Maintenance: if the solution is still maintained by its creators (based on the date of the last commit)
Comprehensiveness: how complex and universal the solution is
Usability: how many useful functions it offers
For the solutions available on GitHub I’ll also take a look at two other important things:
Stars: how popular it is based on Github stars (let’s assume for the sake of this review that 250 stars is a very good result)
200-250 stars = 5 points
150-199 stars = 4 points
100-149 stars = 3 points
50-99 stars = 2 points
0 - 49 stars = 1 point.
Open issues: how many issues (bugs or missing functionalities) have been reported and have not yet been resolved (the bigger the number the lower the score)
The gem named “invoicing” will probably be the first thing you will encounter when searching for invoicing solutions for your Rails service.
It offers a wide range of functionalities. Here are only some of them (taken from the official documentation):
Representing customer and supplier accounts, as well as multi-party billing relationships;
Automatically rounding currency values to the customary precision for that currency, e.g. based on the smallest coin in circulation;
Supporting any number of different currencies simultaneously;
Rendering invoices, account statements etc. into a fully customizable HTML document;
Providing default Value Added Tax (VAT) implementation and the ability to plug in your own tax logic;
Summarising account balances, sales statements, etc. under chosen conditions (e.g. data from one quarter, or payments due at a particular date).
Sounds good doesn’t it? Let’s add very easy installation and initialisation, many useful features and well-written guides, and we may end up with the perfect solution at the very beginning of our little investigation. Unfortunately, things start to get a bit disappointing when you check the date of the last commit and see “3 years ago”. What a shame!
This piece of code isn’t a gem. Instead, it’s an out-of-the-box solution for invoice management based on Rails.
It’s described as “an open source web application meant to help manage and create invoices in a simple, straightforward way”. It's still being maintained (the last commits were 18 days ago) and offers a basic range of useful functionalities e.g. drafting, printing, as well as managing customers and products. It also comes with a nice plain layout and seems to be very easy to use.
Even if you don’t need a separate solution you can still find some inspiration in siwapp on how to improve your own approach to invoicing within your app.
Another out-of-the-box solution for invoicing created in Rails is: active_invoices.
Its name comes from the gem it’s based on, called active_admin, which provides a basic administration panel. The author describes it as a “very simple invoicing application”, and these words are the most accurate review it could receive.
But simplicity doesn’t always come hand in hand with usefulness- especially that it hasn’t been maintained since the end of 2012 (maybe due the end of the world being in that year- which was real in some cases after all!)
Ease of use
When none of the 'out-of-the-box' solutions to our invoicing problem fit your needs it’s good to consider some other options.
There are plenty of tools and applications meant to help with creating and managing invoices, many of them offering their own APIs. This usually offers more possibilities and functionalities, but on the other hand, implementing a complete solution is much more time consuming. It’s definitely sensible to consider such an option if we need a complex solution or just want to have everything under absolute control.
In exchange for higher implementation costs you will receive a custom high-quality solution adjusted to your needs.
Here are some online invoicing and accounting providers who offer nice, rich APIs- the scores reflect how these types of solutions compare: