Payment Gateway System Design | Payment Processing | System Design

preview_player
Показать описание
Payment Gateway is a software used by ecommerce website to help buyer make payment online. It is usually integrated with a payment ingestion and payment processing unit. In this video I have talked about how card payment works, how 3D secure card payment works, how will you design your own system like Razorpay, Paypal etc. High level software design of payment gateway has been discussed here along with relevant APIs which each service will use.
Payment is a very big domain hence capturing each details in one video is tough and same goes for system design interview or coding interview. Do discuss with your interviewer the topic where focus is required from interviewer's point of view and drill deep into it.

0:00 Introduction
0:45 Content
02:15 Terms to Note
06:03 How Card Payment works?
10:08 How 3D secure Card Payment works?
14:21 Requirements for System Design of Payment Gateway
15:43 Design Considerations
17:46 High Level Design
25:30 Relevant APIs
27:42 Payment Processor
32:55 Susbcribe

Рекомендации по теме
Комментарии
Автор

I have read several YouTube videos forpayment gateway system design and this is the most detailed one I have ever seen

dcz
Автор

Good high level overview overall. You missed explaning how failure scenarios are handled which are also crucial to discuss here IMO.
1. How do you ensure Database and Distributed Queue stay in sync? It can happen that database got updated but not the Distributed Queue. e.g. Payment gateway updates database and before it could write to distributed log queue, the payment gateway instance dies.
2. How do you ensure you get exactly-once semantics from the distributed queue so that you don't double process the same txn? e.g. if Payment processor processes the txn and before it could update distributed queue offset, the instance died. When the new instance of processor comes up, how will it ensure the same txn id is not processed again?

jigarbhati
Автор

But in CAP theorem, sacrificing P doesn’t make sense as networks are unreliable. We just cannot have CA systems. They would be either CP or AP.
In our case, consistency is even more important. So, it should probably be a CP system.

Paradise-kvfn
Автор

I think we Don't need to create a separate API for each payment methods like upi, e-wallets . Payment gateway will call psp and psp will have routing engine which will route the request depending upon payment methods like cards e-wallet etc. This will help right from beginning I.e from load balancer where loads can be distributed on the basis of payment method id to dB

omprakash-dzxh
Автор

Is the Distributed Queue part of OLTP. Do we collect the data from both database and distributed queue for analytic purpose?

prabhatshrama
Автор

Explained in simple way with indepth knowledge.. only failed transaction topic couldn't understood in technical terms API and DB impact..

poorti
Автор

Your understanding of the partition tolerance in the CAP theorem is incorrect. In a distributed system, partitions can’t be avoided. So, while you can discuss a CA distributed system in theory, for all practical purposes, a CA distributed system can’t exist. So, you can't chose consistency and availability over partition tolerance. And if you prefer consistency and availability over partition tolerance, then in case a partition happen (which is normal in distributed systems), the system won't work (thus affecting availability).

ThinkSoftware
Автор

Is "connecting to external system from internal" a correct design ? or do we need to add something between Payment Processor and outside for security ?

ErhanPatir
Автор

Very clear and precise, clear cut information...

sukumaradvaith
Автор

the explanation is good but consistency and availability are 2 conflicting goals.

most distributed systems must be designed with partition tolerance as a non-negotiable requirement. This means that during network partitions, the system must continue to operate and serve requests to the best of its ability, even if this results in temporary inconsistencies or reduced availability.

rahulg
Автор

This is an incredibly helpful video. A million thanks!

even
Автор

Wouldn't creating partition on the basis of date presents problem of hot partition, considering 10M transactions/day.
Can we create partitions on the basis of transactionId, as query based on date will be used in clearing service which is done in background, WDYT?
Also there can be a transaction archival service which can move the past day transaction to Cassandra for reducing load on RDBMS.

uditagrawal
Автор

Very clear! It helps a lot. Thank you very much.

jen-yaku
Автор

Hey, one question, I believe there should be only one service that interacts with the DB, if you have two components writing to the DB, it will not centralise the logic in one place. So what i mean is to expose the database via apis. Let me know your thoughts on this.

aakashmendiratta
Автор

persistence to DB and message queue will not be transactional, based on the diagram shown, we will have to use outbox pattern with CDC to achieve this

skblabla
Автор

the Video is 1 year about, but there still SSL in communication. Should I continue to watch it?

egor.cleric
Автор

why ssl no tls? seems ssl has been deprecated.

BlackGodOfWarTom
Автор

Can you tell me which coding and code stack is best for NBFC/ Bank EMI transaction? And what is the future possibility like AI?

AdityaKumar-hopm
Автор

one thing PG only makes a card txn not net banking and e-wallets. and other Card networks they issue 6-digit BIN to issuing banks

pragatianant
Автор

If Payment Ingestion and Payment Processor services are two different microservices, shouldn't they have acess to different databases? The way you described they're using the same database, is that right?

RaphaelSousa-ordl