For this week’s publication, we’ll cowl:
-
How does VISA work once we swipe a bank card at a service provider’s store?
-
What are the variations between naked metallic, digital machines, and containers? (YouTube Video)
-
How do you pay out of your digital wallets, corresponding to Paytm, Paypal, and Venmo, by scanning the QR code?
-
Flash sale system
-
System design train
How does VISA work once we swipe a bank card at a service provider’s store?
VISA, Mastercard, and American Specific act as card networks for clearing and settling funds. The cardboard buying financial institution and the cardboard issuing financial institution might be – and sometimes are – completely different. If banks had been to settle transactions one after the other with out an middleman, every financial institution must settle the transactions with all the opposite banks. That is fairly inefficient.
The diagram reveals VISA’s position within the bank card cost course of. There are two flows concerned. Authorization circulate occurs when the shopper swipes the bank card. Seize and settlement circulate happens when the service provider desires to get the cash on the finish of the day.
🔹Authorization Circulate
Step 0: The cardboard issuing financial institution points bank cards to its clients.
Step 1: The cardholder desires to purchase a product and swipes the bank card on the Level of Sale (POS) terminal within the service provider’s store.
Step 2: The POS terminal sends the transaction to the buying financial institution, which has supplied the POS terminal.
Steps 3 and 4: The buying financial institution sends the transaction to the cardboard community, additionally known as the cardboard scheme. The cardboard community sends the transaction to the issuing financial institution for approval.
Steps 4.1, 4.2, and 4.3: The issuing financial institution freezes the cash if the transaction is accredited. The approval or rejection is shipped again to the acquirer, in addition to the POS terminal.
🔹Seize and Settlement Circulate
Steps 1 and a couple of: The service provider desires to gather the cash on the finish of the day, so that they hit ”seize” on the POS terminal. The transactions are despatched to the acquirer in batches. The acquirer sends the batch file with transactions to the cardboard community.
Step 3: The cardboard community performs clearing for the transactions collected from completely different acquirers, and sends the clearing recordsdata to completely different issuing banks.
Step 4: The issuing banks affirm the correctness of the clearing recordsdata, and switch cash to the related buying banks.
Step 5: The buying financial institution then transfers cash to the service provider’s financial institution.
Step 4: The cardboard community clears the transactions from completely different buying banks. Clearing is a course of during which mutual offset transactions are netted, so the variety of whole transactions is lowered.
Within the course of, the cardboard community takes on the burden of speaking to every financial institution and receives service charges in return.
Over to you: Do you assume this circulate is approach too difficult? What would be the way forward for funds in your opinion?
What are the variations between naked metallic, digital machines, and containers?
When deploying a contemporary software stack, how will we determine which one to make use of?
How do you pay out of your digital wallets, corresponding to Paytm, Paypal, and Venmo, by scanning the QR code?
To know the method concerned, we have to divide the “scan to pay” course of into two sub-processes:
-
Service provider generates a QR code and shows it on the display screen
-
Client scans the QR code and pays
Listed here are the steps for producing the QR code:
-
Once you need to pay on your purchasing, the cashier tallies up all the products and calculates the overall quantity due, for instance, $123.45. The checkout has an order ID of SN129803. The cashier clicks the “checkout” button.
-
The cashier’s laptop sends the order ID and the quantity to PSP.
-
The PSP saves this data to the database and generates a QR code URL.
-
PSP’s Cost Gateway service reads the QR code URL.
-
The cost gateway returns the QR code URL to the service provider’s laptop.
-
The service provider’s laptop sends the QR code URL (or picture) to the checkout counter.
-
The checkout counter shows the QR code.
These 7 steps are accomplished in lower than a second. Now it’s the buyer’s flip to pay from their digital pockets by scanning the QR code:
-
The buyer opens their digital pockets app to scan the QR code.
-
After confirming the quantity is appropriate, the consumer clicks the “pay” button.
-
The digital pockets App notifies the PSP that the buyer has paid the given QR code.
-
The PSP cost gateway marks this QR code as paid and returns successful message to the buyer’s digital pockets App.
-
The PSP cost gateway notifies the service provider that the buyer has paid the given QR code.
Over to you: I’ve detailed how you can pay utilizing a dynamic QR code. It’s dynamic as a result of the QR code is dynamically generated every time. However generally, you may pay by scanning a printed QR code in a service provider’s store, which is known as the static QR code. Have you learnt how a static QR code works?
Flash sale system
Designing a system with extraordinarily excessive concurrency, excessive availability, and fast responsiveness wants to think about many points 𝐚𝐥𝐥 𝐭𝐡𝐞 𝐰𝐚𝐲 𝐟𝐫𝐨𝐦 𝐟𝐫𝐨𝐧𝐭𝐞𝐧𝐝 𝐭𝐨 𝐛𝐚𝐜𝐤𝐞𝐧𝐝.
See the diagram under for particulars:
𝐃𝐞𝐬𝐢𝐠𝐧 𝐩𝐫𝐢𝐧𝐜𝐢𝐩𝐥𝐞𝐬:
-
Much less is extra. Fewer parts on the net web page, fewer information queries to the database, fewer internet requests, fewer system dependencies
-
Quick vital path. Fewer hops amongst companies or merge into one service
-
Async. Use message queues to deal with excessive TPS
-
Isolation. Isolate static and dynamic contents, isolate processes and databases for uncommon gadgets
-
Overselling is dangerous. When and how you can handle the stock is essential
-
Person expertise is essential. We don’t need to inform customers that they’ve efficiently positioned orders however later inform them no gadgets can be found
Let’s attempt one thing completely different right now.
Assuming in a system design interview, you’re requested to design a distributed message queue. The next necessities are given:
-
Producers ship messages to a message queue.
-
Shoppers devour messages from a message queue.
-
Messages might be consumed repeatedly or solely as soon as.
The diagram under reveals the naive design.
🔹Is the design appropriate?
🔹Do you assume the design satisfies all the necessities?
🔹If not, what else must be added?
Be happy to make your assumptions, remark with something you assume may be useful, or publish your design.
Our bestselling ebook “System Design Interview – An Insider’s Information” is obtainable in paperback and digital format.
Paperback version: https://geni.us/XxCd
Digital version: https://bit.ly/3lg41jK
New System Design YouTube channel: https://bit.ly/ByteByteGoVideos