Building Webhook Best Practices (mainly for Stripe)

I am setting up my Stripe webhooks and I just want to confirm for best practices... Stripe mentions to respond with a 200 fast. I think the limit is 5 seconds before a retry is sent. When it comes to doing business logic with a Stripe event or any webhook event, should you always use waitUntil so the Worker responds with a 200 fast?
2 Replies
zegevlier
zegevlier16mo ago
I would not do that. If something goes wrong, stripe will not retry the webhook, nor will you have any good insight into what went wrong or even that something went wrong. I would either use #queues-beta, but that is still in beta so not great for important stuff like payments. Alternatively, you could put the data of the webhook in a DO, set an alarm for 0 seconds from now, and do the business logic in there. This will offer retries and will let you more easily add logging than in wait Until.
Tin Cap
Tin Cap16mo ago
5 seconds is a very long time for a computer. Are you doing something you expect to take more than 5 seconds?
Want results from more Discord servers?
Add your server