How to Do Basic Invoicing for Your Ruby on Rails Application

Photo of Marek Mikołajczyk

Marek Mikołajczyk

Updated Aug 3, 2023 • 4 min read

Invoicing is a crucial part of every application which supports any kind of payments.

If you don't need a very sophisticated custom solution, available Ruby gems will be a perfect option for you.

My assumption is that you have some basic app structure with orders, products and so on.

What You Will Use:


  • easy setup,
  • easy usage,
  • no alternatives.


  • very simple,
  • invoice PDF template is written in DSL instead of HTML.

Step 1

Firstly, we have to do the basic setup of invoicing gem, which can be found here:

Step 2

The Codemancers website pretty much explains how to use the invoicing gem, but not everything is covered.

First of all, you’ll be really happy when you install (at least for testing purposes) some kind of admin panel which will allow you to easily modify the values and have a bigger perspective on what is available for you. I chose RailsAdmin for this as it doesn’t require any additional setup. You can easily remove it later.

Step 3

Nothing fancy if you want to create it through console:


Step 4

Create PDF from your invoice:


Unfortunately, if you want to modify your template, you’ll have to override the class and learn how the Prawn DSL works.

An alternative solution is to use wicked_pdf which will allow you to render your invoice directly from the controller action (in the admin panel or wherever you’re going to put the “Generate PDF” button) using HTML/HAML partial.

Personally, I prefer to create my own invoice templates because it gives me the ability to define my own attributes in a generated PDF and not rely completely on gem implementation.


You now have a working application with a basic invoicing system and you’re able to generate PDFs from them. I tried to find some other gems, but it looks like there are no alternative solutions that are worth mentioning. So, note to you, you can always create your own gem with better implementation but, to be honest, the problem isn’t really that complicated. Most developers just write their own solutions that are easier to customise. If you have any problems, you can always check our Ruby on Rails consulting.


Photo of Marek Mikołajczyk

More posts by this author

Marek Mikołajczyk

Marek started at Netguru as a great Ruby intern and stayed for good. He’s been interested in...
Lost with AI?  Get the most important news weekly, straight to your inbox, curated by our CEO  Subscribe to AI'm Informed

We're Netguru!

At Netguru we specialize in designing, building, shipping and scaling beautiful, usable products with blazing-fast efficiency

Let's talk business!

Trusted by: