EP15: What happens when you swipe a credit card? Also…
For this week’s newsletter, we will cover:
How does VISA work when we swipe a credit card at a merchant’s shop?
What are the differences between bare metal, virtual machines, and containers? (YouTube Video)
How do you pay from your digital wallets, such as Paytm, Paypal, and Venmo, by scanning the QR code?
Flash sale system
How does VISA work when we swipe a credit card at a merchant’s shop?
VISA, Mastercard, and American Express act as card networks for clearing and settling funds. The card acquiring bank and the card issuing bank can be – and often are – different. If banks were to settle transactions one by one without an intermediary, each bank would have to settle the transactions with all the other banks. This is quite inefficient.
Thanks for reading ByteByteGo Newsletter! Subscribe for free to receive new posts and support my work.
The diagram shows VISA’s role in the credit card payment process. There are two flows involved. Authorization flow happens when the customer swipes the credit card. Capture and settlement flow occurs when the merchant wants to get the money at the end of the day.
Cutting down cycle time with dev workflow automation: a 3-minute case study (Sponsor)
Nothing else matters when your dev team’s cycle time is too long: Customers don’t get their features. Sales can’t deliver on promises. The entire business is stuck.
In this 3 minute (video + written) case study, Dama Financial CTO Zach Goldberg explains how they managed to improve cycle time by aligning the team to DORA metrics provided by LinearB. “We’re constantly coaching [engineers to make] small pull requests, small commits… to keep things moving” explains Zach. “As a tool for improving behaviors and habits on a day-to-day basis, LinearB is always brought up.”
See the full case study to learn how to help engineers—and get the data—to make the decisions that reduce cycle time and increase your team's impact.
What are the differences between bare metal, virtual machines, and containers?
When deploying a modern application stack, how do we decide which one to use?
How do you pay from your digital wallets, such as Paytm, Paypal, and Venmo, by scanning the QR code?
To understand the process involved, we need to divide the “scan to pay” process into two sub-processes:
Merchant generates a QR code and displays it on the screen
Consumer scans the QR code and pays
Here are the steps for generating the QR code:
When you want to pay for your shopping, the cashier tallies up all the goods and calculates the total amount due, for example, $123.45. The checkout has an order ID of SN129803. The cashier clicks the “checkout” button.
The cashier’s computer sends the order ID and the amount to PSP.
The PSP saves this information to the database and generates a QR code URL.
PSP’s Payment Gateway service reads the QR code URL.
The payment gateway returns the QR code URL to the merchant’s computer.
The merchant’s computer sends the QR code URL (or image) to the checkout counter.
The checkout counter displays the QR code.
These 7 steps are completed in less than a second. Now it’s the consumer’s turn to pay from their digital wallet by scanning the QR code:
The consumer opens their digital wallet app to scan the QR code.
After confirming the amount is correct, the client clicks the “pay” button.
The digital wallet App notifies the PSP that the consumer has paid the given QR code.
The PSP payment gateway marks this QR code as paid and returns a success message to the consumer’s digital wallet App.
The PSP payment gateway notifies the merchant that the consumer has paid the given QR code.
Over to you: I have detailed how to pay using a dynamic QR code. It is dynamic because the QR code is dynamically generated each time. But sometimes, you could pay by scanning a printed QR code in a merchant’s shop, which is called the static QR code. Do you know how a static QR code works?
Flash sale system
Designing a system with extremely high concurrency, high availability, and quick responsiveness needs to consider many aspects 𝐚𝐥𝐥 𝐭𝐡𝐞 𝐰𝐚𝐲 𝐟𝐫𝐨𝐦 𝐟𝐫𝐨𝐧𝐭𝐞𝐧𝐝 𝐭𝐨 𝐛𝐚𝐜𝐤𝐞𝐧𝐝.
See the diagram below for details:
𝐃𝐞𝐬𝐢𝐠𝐧 𝐩𝐫𝐢𝐧𝐜𝐢𝐩𝐥𝐞𝐬:
Less is more. Fewer elements on the web page, fewer data queries to the database, fewer web requests, fewer system dependencies
Short critical path. Fewer hops among services or merge into one service
Async. Use message queues to handle high TPS
Isolation. Isolate static and dynamic contents, isolate processes and databases for rare items
Overselling is bad. When and how to manage the inventory is important
User experience is important. We don’t want to inform users that they have successfully placed orders but later tell them no items are available
Other things we made:
Our bestselling book “System Design Interview - An Insider’s Guide” is available in paperback and digital format.
Paperback edition: https://geni.us/XxCd
Digital edition: https://bit.ly/3lg41jK
New System Design YouTube channel: https://bit.ly/ByteByteGoVideos
Thanks for reading ByteByteGo Newsletter! Subscribe for free to receive new posts and support my work.