Manual Stripe invoicing for the glorious benefit of your business customers
Stripe is a great service — it enables you to easily start accepting card payments in a multitude if currencies. But Stripe lacks good support for one feature that is important for many business customers: manual invoicing. In this short article I will show you how I tackled this problem as part of my work with Linknow.
Background
There is no need to waste too many pixels on explaining why this would be useful. Some business customers/purchase managers are quite simply forbidden from using their cards for anything but [PoS][pos] purchases below a certain limit. Not being able to serve this group is a wasted business opportunity and something that needs to be handled.
There are third party SaaS vendors that provide this feature, such as Chargebee but using a separate solution like that where you have to give up a percentage of your revenue might not be appropriate in all circumstances. In this article, I will show you how.
The (to me) surprising solution
Now this was originally going to be a much longer article about how to extend credit to the customer automatically by hooking into the Stripe billing cycle, while at the same time deducting given credit from the invoice object so as to mask the credit given from the actual customer and give the appearance of an “unpaid” invoice to them.
Turns out doing this more complicated solution was not necessary at all, and I had to scrap most of the previous version of the article (including the code I wrote) just before publishing due to coming up with a vastly superior solution. Stripe actually does have a native feature that enables a very basic version of manual billing.
Normally when creating a Stripe subscription, the customer needs a payment source (which they won’t have unless they are paying with a card) or account credit enough to cover the first bill for the subscription they have chosen. If any of these demands are not met, the creation will simply fail.
However, if you pass "billing": "send_invoice"
instead of the default of "billing": "charge_automatically"
on subscription creation in the API the customer will actually be granted credit for a certain period that you can define in the subscription settings in the Stripe dashboard.
You can also set what will happen when the customer is overdue on paying: either cancel the subscription outright, mark it as “unpaid” or ignore the condition. This can be done 30, 60 or 90 days after the payment is due.
For a manual method like this where Stripe has no way of knowing if the customer has paid or not, you should make it a routine to regularly check the corporate account for payment and it is probably a good idea to be slightly lenient on subscription canceling — there is of course a chance that you forgot to mark the invoice as paid yourself!
For some reason, when Googling for solutions to this problem I did not come up with anything suggesting I could do this at all. All I could find were different methods for extending credit to the customer by hooking into the billing cycle and naturally I assumed this was the only way. Go figure when I finally found out how easy it really was…
The Stripe documentation is quite hazy in my opinion for what must be a very common wish/requirement for business customers outside of the US. It is of course my own fault that I did not discover this way earlier, but some clear guidance would have been great.
Some caveats
There are some caveats of course. The solution is very basic, and you probably won’t be able to use the actual invoices that Stripe generates because of this.
For Linknow, we need to decorate the invoices with a lot of info about which connectors the customer is using and also payment instructions would need to be added. Unfortunately you are barely given any controls at all for customizing the actual PDF invoice that Stripe sends, except the color (yes, a single definable color) and a 120-character limited textbox which is barely enough for IBAN account information.
We opted to disable the automatic sending of the invoices and instead opt for our own solution with a custom invoice appearance, populated by the data of the corresponding Stripe invoce mixed in with our own — an almost perfect solution for our needs. But then of course we had to arrange our own “html-to-pdf-to-email” functional chain, but once that is done, the solution is I dare say perfect.
That’s all for now, and I hope you found this article useful. Happy Striping!