fbpx
Vadim
Struk
Product Manager at Relevant Software

Building Payment Systems Based on Distributed Architecture: Benefits & Best Practices

Fintech

Building a payment system based on distributed architecture would be impossible without the technology and knowledge we have today. To be fair, it would have also been unnecessary  — until recently. 

Modern businesses need to process hundreds if not thousands of digital payments daily. The percentage of online, contactless NFC, and QR code payments keeps growing. Statistics show that Europe alone churns out about 46 billion online financial transactions per year. 

Developing distributed systems is the right way to achieve the level of performance and stamina required to effectively deal with an ever-increasing number of payments made via the internet. No wonder behemoths like Uber and Airbnb have already adopted this type of architecture for their payment software. 

Knowing a thing or two about financial app development, Relevant constantly tracks the latest fintech trends. In this article, we’ll touch on the benefits of distributed payment systems, their architecture, and logic. To give you more context, we’ll also briefly look at some real-life implementation cases and provide a list of guidelines for building a payment solution of your own.

Let’s begin by answering a seemingly simple question.

Why use distributed architecture for a payment system?

The decline of cash payments continues. Customers today want to pay for products and services instantly and in electronic format. If a payment takes too long, fails to go through, or results in a double charge, why stick with this merchant when there are a dozen others ready to replace them? 

The use of distributed architecture for payment systems allows businesses to meet the highest requirements for reliability and speed while making the software easily scalable. In the next sections, you’ll find out what makes all these possible. But first—let’s get the terminology clear.

The use of distributed architecture for payment systems allows businesses to meet the highest requirements for reliability and speed while making the software easily scalable.

What is the distributed system architecture?

In simple terms, a distributed system consists of independent software components that run on different physical machines, often scattered across several geographic locations. The parts are tightly integrated and communicate via messaging to complete the tasks assigned to them. And if ever there was a perfect environment to accommodate such software, it’s the cloud.

Hosted on cloud servers, distributed systems (also referred to as distributed computing and distributed databases) can offer unparalleled performance and flexibility. 

Fintech Product Development Best Practices
Learn how to build a fintech product given the latest trends & challenges.
Get a copy

Let’s go over some of the main advantages of this architecture.

The main benefits of a distributed system

As a concept, distributed systems have applications in many domains. The following perks are especially valuable in regard to financial operations:

  • Reliability. Distributed systems come with data replication and backup practices ingrained in their logic. A most welcome feature when you’re dealing with the customers’ money and private information. 
  • Efficient load management. With 400 million active registered users (as of Q2 2021), payment services like PayPal are a continual stress test for any combination of software and hardware. Today only distributed systems can handle such an overwhelming avalanche of data and transactions, with the right load allocation tools in place. 
  • Scalability. Being able to connect multiple nodes or servers when needed is fundamental for a flexible system. Using this feature to accommodate the growing volume of your business transactions is the next logical step. 
  • High availability. With the right cloud service providers, you can achieve an uptime of up to 99,99% all year round. This is not only impressive but is absolutely essential for a payment system.
  • Low latency. The geographic location of your servers plays a big role. Payments made in Europe shouldn’t be processed in the US—and vice versa. You will need blazing-fast database access and response times, and using the cloud provider’s nearest servers is the simplest way to achieve that. 

There are more specific benefits to cover, but you’re probably here to find out how to build a distributed system for payments. The following section should cover all the bases.

Key concepts and best practices for building a large-scale distributed system

When it comes to building distributed payment systems, every project will have unique requirements, so the technical means of meeting them will vary. We’ll provide you with an extensive list of industry-proven practices and concepts that Relevant would use in our future work.

List of Industry-Proven Practices and Concepts for Building a Large-Scale Distributed System

Logic: queues, idempotency, actor model, reactive principles

These are some essential concepts that should never be overlooked. We won’t dig so deep as to overwhelm you. If you hire a dedicated software development team, they’ll help you deal with technicalities in practice.

Queue-based architecture

As we mentioned before, distributed payment systems utilize queues to track the order of requests and responses. Important addition is the internal payment processor, which should perform its queries asynchronously, meaning in a strictly defined succession. This is done to prevent an erroneous system response before a request has been processed.  

Idempotency

You may be familiar with how Einstein allegedly defined insanity as “doing the same thing over and over while expecting different results.” Well, he would have been thrilled to know that modern distributed payment systems now have idempotency on their side. Because no one wants a financial instrument that behaves unpredictably.

Idempotent logic ensures that no matter how many times you repeat an action, it will return a result exactly as intended by the original design. This means, for instance, that a payment won’t go through multiple times as the customer keeps refreshing a retailer’s webpage.

Actor model

The system treats its code components as actors that interact with each other via messages. Actors can relay messages that tell other actors to change their state or repair themselves after a crash. The model offers a comprehensive and robust toolkit for describing even the most complex systems.  

Reactive principles

Reactive architecture provides a solid backbone for large projects that require scalability and resilience. The approach is indispensable when working with large volumes of incoming data and allows the system to reliably handle sudden activity spikes. An increasingly popular trend, the use of microservice databases, is a great example of leveraging reactive architecture to achieve efficient data management.

Data: durability, sharding 

Healthy data management practices and realistic requirements will ensure a hassle-free workflow and secure database transactions. Here’s what you need to consider when building a distributed payment system. 

Durability

Customer data is a valuable commodity, and its quality must not degrade over time. You simply can’t afford to lose payment data; so even if a node goes down in flames, a backup should be immediately available.  

Sharding

Sharding is a complicated algorithm for managing distributed databases. Keeping your data split into smaller segments located on multiple machines helps ensure proper load distribution. 

Hardware and network: availability, resilience, scalability

All of the principles listed above would not get you far without the proper hardware. Having the right equipment and setting it up correctly is key for building a distributed payment system. However, it’s worth noting that as those systems are mostly based on cloud architecture, your in-house IT team won’t be doing any maintenance on the servers.

Availability

Your SLAs (service-level agreements) should reflect the following parameter: don’t expect a round number of 100%, since even top-of-the-line cloud services like Amazon AWS typically offer 99,99% availability. This means that the service will be online and operational all year long, except for perhaps 50 minutes. And that’s unlikely to be 50 minutes in a row.

Resilience

Your distributed system should be able to recover from crashes with minimum to no downtime. The choice of the cloud provider is just as important here as the quality of code.

Scalability

This is one of the primary reasons for implementing a distributed payment system in the first place. You want to be able to seamlessly up or downscale your solution on the go. On top of that, it needs to be future-proof. So your IT partner’s knowledge of digital banking infrastructure and their choice of tech stack should be impeccable.

The explanation of distributed payment system development would be incomplete without a case study. We’ve prepared two and kept them brief, focusing only on the most critical details.

A pair of use cases: Uber and Airbnb

Leaders in their respective industries, these names loom large, casting shadows over the competition. Both Uber and Airbnb have adopted distributed payment systems in their workflows. And it’s hardly surprising.

Uber

The apps of the world’s largest ride-sharing company are based on a distributed architecture. Strangely, there was a time when their payment systems weren’t. The move to incorporate these systems made all the sense in the world since it addressed major pain points. Here are some key reasons for the transition:

Key Reasons for Uber's Transition to Distributed Architecture
  • Substantial geographic coverage. The latest available data suggests that Uber currently operates in 69 countries, serving more than 900 metropolitan areas. By using distributed systems, engineers were able to reduce latency, as well as ensure compliance with country-specific financial regulations.
  • Heavy peak loads. Remember the “increased demand” notification and immediate price surge that everyone loves so much? It’s not groundless. In New York, for example, cab traffic increases tenfold at 8 pm compared to 5 am, according to a study. Handling such an upswing in payment transactions is near impossible without a system that can intelligently distribute tasks to adjacent nodes.
  • Working round the clock. Need a ride to the airport at 2 am? Or a food delivery at 6 in the morning? Such needs mean that Uber’s payment servers have no downtime, calling for a distribution model with the highest possible availability. 

Uber doesn’t share specific financial data. But it would be safe to assume that these improvements had a significant impact on the company’s ROI. The distributed approach also makes horizontal scaling possible, a must-have feature, taking Uber’s aggressive expansion into account. 

Airbnb 

Airbnb’s migration to a Service Oriented Architecture (SOA) wasn’t painless. But their payment system survived and came out performing better than ever. Here’s how they did it and what challenges they focused on:

  • Inherent drawbacks of the SOA model. The architecture in question offers many benefits, such as developer-friendliness and better API compatibility. However, it comes with a caveat: poor data integrity. The developers at Airbnb had to use three different approaches to rectify the situation: read, write, and asynchronous repair. As a result, data consistency was brought up to expected standards.
  • Double payments. The cost of accepting the same payment twice can be as high as losing a customer. Airbnb needed the new system to avoid such mix-ups. The concept of idempotency—an integral part of distributed solutions—came to the rescue. The algorithm is capable of repeating the charge attempts as many times as needed, always resulting in no more than a single transaction.
  • Separation of network and database activity. As network calls were vulnerable and often resulted in poor performance, the engineers had to find a way to separate them from the database work. The solution helped maintain data integrity and improved response times.

By overcoming these and other challenges, the team at Airbnb was able to create a modern distributed payment solution that is fully compatible with SOA. 

Summing up

The days of batch processing and on-premise servers are almost over in banking and fintech. Cloud-based systems are taking over, enabling distributed check processing and other types of digital payments, powering money transfer software, and serving the needs of businesses of every size.

The idea of building a payments system based on distributed architecture might seem overwhelming at first, but it’s worth the trouble in the long haul. You just need a little help taking the first steps.

With our full range of fintech software development services, Relevant is ready to take on projects of any kind. You can hire remote developers and enjoy the benefits of outsourcing to Ukraine as soon as you’d like.

Contact us now, and we’ll answer all your questions.

FAQ

Your Next Read

Written by
Vadim Struk
Product Manager at Relevant Software
For more than 6 years, I've been working as Business Analyst and Product Manager at Relevant. I'm responsible for requirements engineering and management and solution implementation control.

Do you want a price estimate for your project?