With payment systems, you always need a consolidation process (hourly, daily, monthly) based on sound accounting principles that will check the consistency of each cash flow.
In your case, I suggest that each external asynchronous call record the parameters sent and the response received. If you do not have an answer for a certain time, you know that something went wrong in the external system (Stripe, in your case) or on the way back from the external system (you mention a database failure on your side)
Basically, for every asynchronous "transaction" you create, you know when you start it, and you need to decide a reasonable amount of time before it ends. Thus, the database has the expected_END_ts.
If you did not receive a response after expect_end_ts, you know that something is wrong. You can then request the status of Stripe or another PSP. We hope that the API will give you a reasonable answer about whether the payment passed or not.
Also note that you must add a step between 1. and 2: re-read the database. You want to make sure that every payment request that you make is really in the database, saved just like you are going to send it.
source share