jeudi 8 juillet 2021

Understanding how to return errors immediately in a distributed system for payment

A common architecture for handling high volume of payment, e.g. if you're a food delivery app, is a pub/sub architecture with some kind of distributed messaging, e.g. Kafka. The consumer then calls a third-party payment processor. There are often cases in which the third-party payment processor may time-out or might be down so there is additional setup to handle retries. A DB is also usually involved to keep track of payment status, e.g. having an additional consumer setup the record in the DB. A question I am having trouble wrapping my head around is in the case there is a legitimate error, e.g. card details are incorrect, how can this error be returned to the user and in a timely way? We probably don't want to give the user a success message immediately, and then later give them an error?

Aucun commentaire:

Enregistrer un commentaire