After we receive the webhook, we should return 2xx response, prior of doing some additional logic in our backend.
Your endpoint must quickly return a successful status code (2xx) prior
to any complex logic that could cause a timeout. For example, you must
return a 200 response before updating a customer’s invoice as paid in
your accounting system.
They suggest here to first return successful 2xx response, and then to do additional things in our backend. They consider this as best practice so there won’t be a request timeout.
I don’t see how is this best practice, since there is an obvious possibility were our system fails in updating the database for example, and we already returned successful response. That means that Stripe will not try to re-send the webhook later, and we will lose this information since our system didn’t save it.
Are there an existing solution for this sort of problem?