We recently added invoices to Browserling. I thought I'd share how we did it as it's another interesting story.

Our customers keep asking for invoices all the time so we made it simple to create them. They can now just go to their Browserling accounts and download them. Here's how an invoice looks like:


Example invoice. (Download example.)

And here are the implementation details.

We use a node module called invoice. The invoice module takes a hash of invoice details, internally spawns pdflatex that creates a pdf invoice, and then calls a callback with the path to the pdf file, like this:

var invoice = require('invoice');
invoice(
    {
        template: 'browserling-dev-plan.tex',
        from: "Browserling inc\\\\3276 Logan Street\\\\Oakland, CA 94601\\\\USA",
        to: "John Smith\\\\Corporation Inc.",
        period: "2/2013",
        amount: "$20"
    },
    function (err, pdf) {
        if (err) {
            console.log("Failed creating the invoice: " + err);
            return;
        }
        console.log("Pdf invoice: " + pdf);
    }
);

The browserling-dev-plan.tex latex template contains %to%, %from%, %period%, and %amount% place holders that the invoice module simply replaces with the given data:

\documentclass[12pt]{article}

\pagenumbering{gobble}

\begin{document}

\begin{center}
\Large{\textbf{Invoice}} \\
\vspace{0.5cm}
\large{Subscription to Browserling's Developer Plan}
\end{center}

\vspace{1cm}

\section*{Invoice from:}
%from%

\section*{Invoice to:}
%to%

\section*{Period:}
%period%

\section*{Amount:}
%amount%

\end{document}

Once the pdf invoice is generated, we create a token that maps to the pdf file, and once it's requested, we send it to the customer as an application/pdf.

Until next time!

Comments

February 27, 2014, 17:12

Did you put the all important Invoice # on the actual invoices?

I guess I could login and check but it's more fun to be the first to comment.

February 27, 2014, 19:33

Hmm, no I don't. All these payments are automatic so we can track what's been paid. I guess it would matter if the invoices were paid by check. Then it would be harder to track, which payment is for which invoice. Is that right?

April 08, 2014, 10:12

Very nice Idea...I really want to learn more about that.
Proweb365 is a Minneapolis web design firm!

dasf Permalink
May 20, 2014, 12:58

I'm interested in reading this article once more later on. Extreme PC It is a lot for me personally to absorb, nevertheless it's very interesting and I want to understand.

Audi Permalink
May 23, 2014, 12:23

I will return and review your article later on to explore the perfect landscapes you have mentioned. Dermaslim for weight lose and deit plans.

July 09, 2014, 11:24

I just read through the entire article of yours and it was quite good. This is a great article thanks for sharing this informative information.

Tim Permalink
October 30, 2014, 12:53

I'm going to subscribe this website for providing me good information every time .visit mine www.vinitysoft.com for fleet software.

bloger king Permalink
May 13, 2014, 20:49
October 03, 2014, 09:53
May 21, 2014, 19:44

Recover Ur File

June 03, 2014, 10:43

Nice Post i love reading it :)
Paid Android Apps For Free
Thanks for awesome post

November 16, 2014, 08:38

Nice Post i love reading it :)
orthogonal and oblique cutting.
Thanks for awesome post

June 13, 2014, 13:38

www.techkart.net

September 03, 2014, 09:33

Hello there,
I discovered your blog this afternoon
and I want to congratulate you for the work
Congratulations and good luck

September 04, 2014, 07:10

Nice article thanks to share with us. Recruitment Very helpful with me

September 20, 2014, 07:42

http://www.techtrickhub.com/

September 20, 2014, 07:43

http://www.techtrickhub.com/2014/09/download-wechat-for-laptop-pc-windows7-xp-free.html
http://www.techtrickhub.com/2014/09/igu-meerpur-rewari-results.html
http://www.techtrickhub.com/2014/08/download-bbm-for-pc-laptop-free.html

November 13, 2014, 11:34

Thanks for telling how to add invoices to Browserling. Now I can find them in Browserling accounts and download them.

November 20, 2014, 18:31

Hi,
Thanks for add new invoices i love it.. thanks admin

Leave a new comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the word "network": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.

Advertisements