Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check what happens if webhook fails when sending subscription status #198

Open
vincanger opened this issue Jun 28, 2024 · 3 comments
Open

Comments

@vincanger
Copy link
Collaborator

how do we ensure then that our subscription statuses in our DB are in sync with Stripe's?

@Martinsos
Copy link
Member

To explain a bit more: we "cache" status of subscription in User entity, under subscriptionStatus. The realy truth about the status is however on Stripe. We rely on Stripe webhooks to let us know then that status changes, so we update the value in User. But, what if that fails for some reason? We believe that Stripe will try multiple attempts if webhooks are not getting true, but what if server is down long enough for Stripe to give up? Is there a way to tell Stripe to resend all webhooks that never went through on server start (well that might also be challenging to resolve then but ok). Or should we have some conditions (server start, long time since last update) on which we decide to manually check if state is in sync?
Stripe might have some docs on best practices here, as I would expected this is a common issue.

@vincanger
Copy link
Collaborator Author

@Martinsos so apparently stripe resends failed webhook events with exponential backoff.

This article explains how to check which webhook events have failed and manually retrigger them, if desired: https://daniellockyer.com/how-to-resend-failed-stripe-webhooks/

@Martinsos
Copy link
Member

Nice, that means that likely exponential backoff will help, but if server has been down for a longer time, we should do something manual, possibly what they describe in that article.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants