...

/

Design a Payment System - 15 Minute Sprint

Design a Payment System - 15 Minute Sprint

Understand the payment system, its requirements, and the resources needed to design it, and understand how its architecture comes together to form a complete and reliable solution.

We'll cover the following...

A digital payment system is a mechanism that enables individuals and businesses to transfer funds securely and efficiently. It encompasses various methods, including credit cards, bank transfers, and digital wallets, to facilitate the exchange of value. Payment systems include credit and debit card transactions. The core complexity of this system lies in orchestrating communication between multiple entities: the customer (cardholder), the merchant, the acquiring bank (the merchant's bank), the issuing bank (the customer's bank), and the payment gateway (the network facilitating the transaction).

The following figure illustrates the flow of a payment processing system:

Payment processing system and the entities involved in it
Payment processing system and the entities involved in it

The payment lifecycle generally consists of two distinct phases:

  • Authorization: This is the real-time process where the system verifies the card’s validity and availability of funds. If successful, the amount is reserved (held) on the customer's card.

  • Settlement: This occurs later (often in batches). It is the actual movement of funds from the Issuing Bank to the Acquiring Bank to finalize the transaction.

Note: The authorization and settlement phases may not occur simultaneously. Authorization is typically immediate and confirms that a valid payment method and funds are available. On the other hand, settlement may occur in batches and is the process of moving the funds to the merchant’s account in a bulk transfer.

In what scenarios could authorization succeed but settlement fail, and how should the system handle it?

Use the AI assessment widget below to submit your solution and get an interactive response.

The settlement phase

We have explored how the payment processing system works. Now, let’s move on to design a payment system by considering the following requirements.

Requirements

Let’s understand the functional and non-functional requirements of the payment system.

Functional requirements

We are designing a payment system to accept credit or debit card payments via a PSPPayment service provider. Therefore, we will stick to the following functional requirements:

  • User registration and authentication: Users should be able to create accounts, log in securely, and reset passwords.

  • Payment processing: Users should be able to initiate payment processing upon purchasing a product or service. The system should accept payment via credit and debit cards.

  • Transaction history: Users should be able to view a history of their transactions, including dates, amounts, and descriptions.

  • Balance management: Users should be able to check their account balances, including available funds and pending transactions.

  • Mobile accessibility: Users should be able to access and use the payment system through mobile apps or responsive web interfaces.

Non-function requirements

The following are the non-functional requirements that the payment system should meet for smooth operations:

  • Data integrity and security: The system should comply with industry security standards. It should also have robust data encryption and secure storage mechanisms, maintain consistency, and prevent data corruption.

  • Availability: The system should be highly available to ensure users can always access it.

  • Reliability: Redundancy, failover mechanisms, and backup systems should be in place.

  • ...