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

Przemysław Szyszka - Senior Software Developer

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.

Let’s get in touch
Author's Bio
Przemysław Szyszka

Senior Software Developer

Full-Stack software developer focused mostly on Ruby, but in love with Elixir. Enjoys learning new things (patterns, programming languages). Besides programming spends free time on swimming, playing board games or ballroom dancing. Doesn't drink coffee ;)

Similar articles
Rails 7 - what is new?
Rails 7 - what is new?
Here's everything you need to know about Ruby on Rails’ latest update - Rails 7. Update your existing software or use it for web development of a new app.

Bulletproof your development with remote team augmentation

Read how
This page is best viewed in portrait mode
Our websites and web services use cookies. We use cookies and collected data to enhance your experience, provide additional communication channels, improve marketing materials and enhance our offer. IRONIN SP. Z O.O. SP. K. is committed to protecting all the data that we collect or process in any way, especially data of personal nature. By accepting these terms you agree to our usage of cookies and processing your data, according to our Privacy Policy, and you declare that your browser settings reflect your preferences. Read more You have the right to revoke this agreement at any time, based on the terms of our Privacy Policy. You can change cookies settings in your browser. If you do not agree with us using cookies and processing your data, please change your cookies settings in your web browser and reject these terms. You can find more information about cookies, your data privacy This site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies. data processing, and your rights in our Privacy Policy.