See all articles

How to successfully develop an application that handles large amounts of payments?

One of the big challenges faced by fintech companies is payment processing. Although modern solutions offer a lot of security and a good user experience, problems begin to occur when the amount of payments that need to be processed goes beyond a certain treshold. If you think about it, it’s clear that at some point, there will simply be too many of them. So, how can fintech apps be prepared for that?

When a large amount of payments becomes a problem

The first thing to know is that issues are often caused by processing all payments at once synchronously. But it doesn’t have to be this way. By choosing the approach presented below, you can avoid many payments-related problems and never disappoint your users.

Start by moving your payments to the background. Not all payments need to go though your system immediately. Essentially, you can assign priority levels to them, for example:

  • 0 - process immediately,
  • 1 - process within to 8 hours,
  • 2 - process within to 24 hours.

Remember that, when sending a payment to an external payment processor, your system (the part of it responsible for processing the payment) always gives it an uniqe identifier which can be used at any point to determine the status of the payment.

A practical guide to asynchronous payments

First, schedule background workers. The effective way to do it is using the push bulk function available in Sidekiq - instead of scheduling workers one by one you can schedule 10k of them, or more, at a time.

Next, introduce a global lock which will limit the number of payments, either per customer. Depending on the use case, this will prevent the customer from overpaying the maximum amount.

Third, keep all status updates of a payment (e.g. pending, processing initiated, submitted to processor, failed, successful). This is extremely helpful in case of any issues with payments for debugging purposes.

Fourth, don't allow the part of your system code responsible for creating payments to be wrapped in database transactions. This way, you should be able to avoid any kind of issue with the payment being created if at any point in the code there will be issues with executing it.

Bonus: how to get the most money from customers

Decide when the payments should be processed. It may sound trivial, but think of it this way: in Poland, most people receive their salaries on 1st day of the month or on the 10th day of the month. In other countries this will be slightly different, but similarly regular. This means that, if you process payments on those dates, you will be more likely to collect your money correctly.

What to do next when just asynchronous processing is not enough?

When the solution explained above is still not enough for your business, consider processing payments based on the customer. Since most customers likely have multiple items that they purchase and will pay with the same credit card for all of them, you might want to total the prices and just process them in one larger payment.

Achieving this isn’t too difficult. Simply write a dedicated service which will group the payments based on the customer. It’s probably best to still handle them asynchronously in most cases, and immediately only when needed.


If you’re building an application that will need to handle large numbers of payments, you don’t necessarily need to worry. Simply make sure that your development team has experience with this challenge, and will be able to overcome it in a smart way.

Start implementing payments correctly right now. Remember - it will be more challenging to change it in the future than to build the right solution in from the start.

We’d be happy to help you introduce asynchronous payment processing to your app.

Read Similar Articles