When we wait for a card payment from the customer, it might take quite some time. Longer than one API request could wait for.

To resolve this issue, the mechanism is:

  • The frontend sends the API request
  • When the backend receives the API request, write an empty database record and respond that the request has been received to frontend
  • The backend keeps going with the execution until the transaction has finished, and update the database record
  • In the meantime, the frontend polls for database update with an interval, and gives feedback to user when it detects the db status has been updated

https://docs.google.com/presentation/d/11JPSXHOiVddjghBWkNPR1uMPAWREigbehoU71AsiWP4/edit#slide=id.g1733f2c0e33_0_48