System design interview - How online payment works using QR code?

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 มิ.ย. 2024
  • QR code is common while doing online payment transfer. Here, I have talked about
    1) using QR code for payment transaction
    2) system design diagram
    3) sequence of flows
    4) Scaling the system
    Similar methods are used in system designs like cash.app, venmo, paypal and google pay.
    The two sequence I have discussed are
    Sequence 1
    -------------------
    Buyer and seller registers in the system
    Buyer goes to store and purchases item. (Stored in Buyer trans table)
    Seller has the transaction stored (Stored in Seller trans table)
    Seller shows the QR code to the Buyer generated by POS device
    Buyers scan the QR code through his phone’s app.
    Buyer enters the amount and clicks OK.
    Money transferred from Buyer to Seller and receipt generated.
    Transaction completes.
    Sequence 2 (Paytm method for street vendors)
    -------------------------------------------------------------------------------
    Buyer and seller registers in the system
    Seller downloads the QR code and displays in front of his store.
    Buyer goes to store and purchases item. (Stored in Buyer trans table)
    Buyers scan the QR code displayed in store through his phone’s app.
    Buyer enters the amount and clicks OK.
    Money transferred from Buyer to Seller
    SMS notification sent to Seller and Buyer for confirmation
    Transaction completes.
    This is an amazon interview question and paytm interview question.
    #systemdesign.
    More about loadbalancer at
    • System design : Why do...
    ------------------------------------------------------------------------------------------------
    Who am I ? : / keerthikanth

ความคิดเห็น • 58

  • @cenos8521
    @cenos8521 3 ปีที่แล้ว +2

    Hi , Thank you for making this video . It was great ! Can you advise me which type of QR code
    would work well for a street performer or vendor ? .. and which type of cell phone would be required ? ... Thanks again for making available to all of us . Very nicely done :)

    • @ReachGoals
      @ReachGoals  3 ปีที่แล้ว

      paypal, square all support this feature. Any smart phone will work.

    • @cenos8521
      @cenos8521 3 ปีที่แล้ว

      @@ReachGoals Thanks a million brother ! It is very kind of you to help people as you have done so well :) You are an outstanding planetary citizen . Thank
      you .

  • @hnwatu
    @hnwatu 7 หลายเดือนก่อน +1

    Impressive

    • @ReachGoals
      @ReachGoals  6 หลายเดือนก่อน

      Thanks. I am glade you like this video.

  • @ushahari4648
    @ushahari4648 2 ปีที่แล้ว

    This is great Keerthi. I will provide my comments at a later time. I am also interested in the payments without QR code such as Venmo payments or via chat message. Will check into this as well. Contactless payments grew exponentially during pandemic.

    • @ReachGoals
      @ReachGoals  2 ปีที่แล้ว

      @Usha, Thanks for the feedback.

  • @mmdutube6763
    @mmdutube6763 ปีที่แล้ว +1

    great job

    • @ReachGoals
      @ReachGoals  ปีที่แล้ว

      Thanks for support and I am glad you like this.

  • @lucascortez2375
    @lucascortez2375 3 ปีที่แล้ว

    Hi thank you for sharing, I like your videos, can you make a video about cash payment system (the buyer select cash option on a website, get a QR code, walks to a store, pays, the store scan the QR code, get a bill on email and the order is on its way), front end and back end.

    • @ReachGoals
      @ReachGoals  3 ปีที่แล้ว +2

      Great suggestion!

  • @sandhyaaa24
    @sandhyaaa24 2 ปีที่แล้ว

    thank you :)

  • @rajeshg3570
    @rajeshg3570 2 ปีที่แล้ว

    Nice explanation . I've few questions here since you are referring to micro services and distributed systems,
    1. Could you please throw some more detailed information around
    a. Do you think all these are transactions synchronous or asynchronous ? Which of them could be synchronous and which of them could be asynchronous
    2. Do you see any requirement for batch processing here?
    3. If yes is the answer for 2nd question, what kind of tool and technology suits this level scale?
    3. Do you see any need to use distributed streaming platforms like Kafka here?

    • @ReachGoals
      @ReachGoals  2 ปีที่แล้ว +1

      1. In the financial world, transaction are sync. If not, the system will show the stale data.
      2. Fintech is full of batch processing. If you need to do behind the scene data transfer, batch process is the recommended options.
      3. Java spring batches.
      4. When you send the data from one point to other, kafka can be used. This prevents single point of failure.

  • @abrahamgigi3976
    @abrahamgigi3976 2 ปีที่แล้ว +1

    Thanks for this great video. My question is, is it possible for the seller to generate a unique QR code for each transaction, like say the code comes with amount for the item, and the buyer can accept or reject the amount?

  • @spirithawk9630
    @spirithawk9630 หลายเดือนก่อน

    Thank you.

    • @ReachGoals
      @ReachGoals  4 วันที่ผ่านมา

      You'r welcome

  • @nilkhwajazada4398
    @nilkhwajazada4398 4 ปีที่แล้ว +1

    What is Sega ? Is it any abbreviation ? Is saga implement into app or or not how it can interact with gateway ?

    • @ReachGoals
      @ReachGoals  4 ปีที่แล้ว +1

      Nil,
      The Saga is a design Pattern in microservices architectural to implement a transaction that spans multiple services. This is only of the way to have transaction in distributed databases.
      SAGAS is a name of the publications and from there this pattern became popular.
      This is the original publications as I said, it is named as SAGAS. I don't know why the Author named like SAGAS.:)
      Refer here for original publications.
      www.cs.cornell.edu/andru/cs711/2002fa/reading/sagas.pdf
      Also, There is another video th-cam.com/video/k925c1WN2LA/w-d-xo.html in this channel about how distributed transaction works in microservices. Please watch that and will be helpful.
      Let me know if you have questions.

  • @meerasingh8601
    @meerasingh8601 3 ปีที่แล้ว

    Hi @reachgoals
    Can you please explain uses cases for how to do payment using registered mobile no and adding banking details like we do on phonepe and Google pay?

    • @ReachGoals
      @ReachGoals  3 ปีที่แล้ว +1

      How to usee phone number or email to transfer funds ?
      1) User A, B create an account using the phone number, emails, address in the app.
      2) A, B will enroll in that app to use phone for payments/cash transfer.
      3) When user A want to transfer funds to B, he will put B's phone number as Target.
      - App will pull the details (account info) of B based on the phone(B's) number.
      - A initiates a transfer. Cash is transferred from A' account to B's account.
      Note: There are multiple levels of validation, encryption etc. happens internally and behind the scene. Hope this helps.

  • @muazzamshahid
    @muazzamshahid 3 ปีที่แล้ว

    Surely it’s a great video 👍 but May you please answer one question that I have👇
    Can we use QR code other way round as well for payments? For example, if the buyer has the QR code (registered/linked with their bank account) on some paper and the seller has the QR Code Scanner.
    Now if the buyer presents their QR code to seller for payment of goods and seller then scans it onto their QR code scanner, as a result seller receives a message on their device asking to enter PIN which buyer will have to enter to approve the transaction. This PIN will be linked by buyer’s bank with their QR code for security purposes. Will it be possible? Remember buyer only has the QR Code and no other physical device with them.
    Thank you

    • @ReachGoals
      @ReachGoals  3 ปีที่แล้ว +3

      Yes this is possible. QR code is nothing but set of information.
      This is similar to credit card usage. You give the card to shop keeper, he scans and you enter the pin on his device to complete the transaction.

    • @muazzamshahid
      @muazzamshahid 3 ปีที่แล้ว

      Reach Goals Thank you

  • @1711nitish
    @1711nitish 3 ปีที่แล้ว

    Explantion is good .But y do we require here 6 tables for db .We can have a table like User which has all these columns and one more column 'user_type' .When seller makes a transaction then this has to be populated with seller else buyer .This can be applicable for other two tables as well which you have shared .

    • @ReachGoals
      @ReachGoals  3 ปีที่แล้ว +1

      You have to understand the Microservices based architecture. In the MS based architecture, database and tables are separated as per the services and use cases. Hence, I decided to do that. Also, you have to think about scalability, sharding etc.

  • @jerry8964
    @jerry8964 2 ปีที่แล้ว

    This is the best video I have seen on the transactional process.... Are you available for private development? If so contact info?

    • @ReachGoals
      @ReachGoals  2 ปีที่แล้ว

      Glad you like this. Hope it helps you.

  • @balwantyadav_
    @balwantyadav_ 3 ปีที่แล้ว

    Please make a video on how third party payment system of payments work like OYO- customer, oyo, hotels etc

    • @ReachGoals
      @ReachGoals  3 ปีที่แล้ว +1

      sure, will do. thanks for feedback

    • @balwantyadav_
      @balwantyadav_ 3 ปีที่แล้ว

      @@ReachGoals waiting.....

  • @weiti0809
    @weiti0809 2 ปีที่แล้ว

    Hi, may I said transaction for `payment` must follow the ACID principles, so we must choose `sql` database in this scenario? Thanks.

  • @anubhavshukla9585
    @anubhavshukla9585 4 ปีที่แล้ว

    But one important thing you didn't mention that if seller schema is successfully updated and then if buyer schema fails to commit , it should also rollback the transaction in seller schema. And that flow is also missing

    • @ReachGoals
      @ReachGoals  4 ปีที่แล้ว

      yes, I didn't cover that. Good you shared in the comment.

  • @holdthel1n331
    @holdthel1n331 3 ปีที่แล้ว

    Hello
    If I engage a 3rd party to create a QR code
    May I ask after a QR code is generated. Can the 3rd party help to change the QR code details again and funds get paid into another designated account

    • @ReachGoals
      @ReachGoals  3 ปีที่แล้ว +1

      I am not sure. Keep in mind, QR code is created based on the certain content. If the content changes, new QR code has to be created. It's how you design the system

  • @navneetrabadiya7776
    @navneetrabadiya7776 4 ปีที่แล้ว

    Your content is quite good, Few points which i have noticed.
    1. When we are reviewing specific component of the system (ie Paytm) i am least bother about how Load Balancer and Mysql works.
    2. In system scaling i am not seeing any usage of the CDN as per the current definition.

    • @ReachGoals
      @ReachGoals  4 ปีที่แล้ว

      CDN will be there in all the system design. I didn't have as use case to shorten the video.
      Loadbalancer will also be there in most of the system design when you have multiple servers.

  • @coolbuddy102
    @coolbuddy102 ปีที่แล้ว

    Generally we dont create Seller and Buyer table, The idea is to keep it generic, something like user with a user account. The transactions happen from one account to another.

    • @ReachGoals
      @ReachGoals  ปีที่แล้ว +1

      Any design is not written in hard stone. The design is debatable.
      The reason I choose is to help in data base sharding in future.

  • @moustafamaher11
    @moustafamaher11 3 ปีที่แล้ว

    what if createSaga failed after writing in the sellerTransactions and before commiting to buyer ?

    • @ReachGoals
      @ReachGoals  3 ปีที่แล้ว

      it's good if you watch this shot video about the distributed transactions in micro-service th-cam.com/video/k925c1WN2LA/w-d-xo.html

  • @nitreall
    @nitreall 2 ปีที่แล้ว

    You don't talk about trade offs at any point. This is one of the important criteria people see in system design interviews.

    • @ReachGoals
      @ReachGoals  2 ปีที่แล้ว

      Thanks for the best feedback. Will think about it in the future videos.

  • @yashsrivastava677
    @yashsrivastava677 3 ปีที่แล้ว +1

    Can you make a system design as to how Visa or Mastercard works

    • @ReachGoals
      @ReachGoals  3 ปีที่แล้ว

      Sure, I will try to explain in the future videos.

  • @anil2009
    @anil2009 2 ปีที่แล้ว

    I'm confused where to start my learning within your channel. please name videos by chapterwise like 1, 1.1, 1.2, 1.3, 2.1, 2.2 .. etc .

    • @ReachGoals
      @ReachGoals  2 ปีที่แล้ว

      I have a play list. please check that.

  • @irshadb6587
    @irshadb6587 3 ปีที่แล้ว

    Would you please share poc with zxing

    • @ReachGoals
      @ReachGoals  3 ปีที่แล้ว

      I am not sure what you are asking? can you help me to understand?

  • @nilkhwajazada4398
    @nilkhwajazada4398 4 ปีที่แล้ว +1

    Hi I need some help about SAGA

    • @ReachGoals
      @ReachGoals  4 ปีที่แล้ว

      What help you need? Please share you question. I am happy to help you

    • @ReachGoals
      @ReachGoals  4 ปีที่แล้ว

      In this video th-cam.com/video/k925c1WN2LA/w-d-xo.html I have simplified explanation of distributed transaction using SAGA. I believe, you will understand.