Coding your own subscription engine? Wait!

19 August 2020- 9 min read

Coding Growth Subscription platform

At first glance, the subscription business seems simple. Customer chooses a plan, gives you their payment details and you charge them once a month. But how would this work under the hood?

Customer chooses a plan

If you have multiple plans this first step can become very complicated. Because if you have multiple plans, your customers tend to switch between them.


Let’s say you have two plans:

  • Plan A: 100 DKK / month
  • Plan B: 80 DKK / 14 days


Pretend a customer has been on plan B for 3 days and now wants to switch to plan A. Do you charge them 100 DKK today, lasting a full month period, or do you charge them x DKK for a period of 1 month - 3 days ? What is x in this scenario? What does it depend on? What about the 80 DKK the customer has already paid? Do you take it into account in your calculations, or is it “lost” ?
These calculations have a lot of edge cases and can become complicated and error-prone to code up. There’s a chance you will overcharge or undercharge your customer if you did not think it through. Both are bad business.

Upodi thought about this for you. Simply configure your business rules in our platform, and we will make sure all cases are handled correctly. You can have different business rules for each subscription plan, giving you more flexibility.


Customer gives you their payment details

Your customer’s payment details are very sensitive information. There exist plugins that handle the data for you. But it is not the complete solution. If you store the data yourself, there are regulations you must follow, specifically regarding PCI Compliance. Usually your payment provider of choice does this for you. But if you are a global brand, the customer’s payment method of choice will differ. If you want to handle credit cards, SEPA payments and the danish Betalingsservice you have a lot of work to do.

Upodi already did it for you. Simply configure your PSP’s (payment providers) on our platform and we will talk directly to them: doing automatic payments, retries, refunds, validation, etc.

Charging your customers

This last step also looks simple at first glance. But it is a big step consisting of many substeps. These are:

  • Detecting that a payment is due
  • Creating an invoice
  • Calculating taxes
  • Booking the invoice into your ERP system
  • Initiating payment
  • Updating payment status
  • Handling payment status.

Many of these steps are manual for a lot of businesses. But not for customers of Upodi, because we’ve automated it all.

What if your customer doesn’t pay?

It happens all the time to subscription businesses, for a variety of reasons. Here are some:

  • Expired credit cards
  • Faulty payment method
  • Declined by bank
  • Fraud detection
  • Chargebacks
  • Server downtime
  • Etc.

You will need to handle these cases separately. The actions you must take can vary too:

Sending out emails, contacting customers, updating payment details, dispute a chargeback, initiate a recharge.

This is called dunning. Usually you have to take several (manual) steps in a specific order depending on the error type.

Upodi does it for you. We have an automatic dunning system in place that you can configure action steps for. Such a configuration could look like:

If a payment fails, retry.
If it failed again, send an email to the customer and wait for a week.
If the invoice is still unpaid, cancel the subscription.
No manual intervention needed.

Things to consider

While subscription engines are very complicated, they are not rocket science. I am sure you can build your own and some day it might serve you well. But understand that it takes a lot of time, commitment and money. Even after it’s finished. Subscription engines are complicated and big pieces of software. They rely on external partners like PSP’s and ERP’s. You will encounter internal IT issues and issues with the external systems. You will need a team of engineers to keep maintaining it and a team of IT operators to swiftly handle downtime and other issues. Even if you’ve built the perfect system, it must talk to external systems which are not. Ask yourself, what is your main business focus? Is it invoicing people or delivering the best possible product to them and maximizing profits?

At Upodi, we know the answer. We hope that you now do as well :)



About the Author

Find out more about the author and follow them and social media to stay connected with them

Osman Toplica

Osman Toplica

Osman is a Senior Software Engineer at Upodi. Osman is a hard worker, who strives to learn and become even better constantly. Combined with his open-mind and curiosity, he is a remarkable team player. He continuously challenges himself with new things, and has now stated to write interesting articles about subscriptions and the coding behind.