diff --git a/apps/dokploy/pages/api/stripe/webhook.ts b/apps/dokploy/pages/api/stripe/webhook.ts index 22a4a087d..c233ba38e 100644 --- a/apps/dokploy/pages/api/stripe/webhook.ts +++ b/apps/dokploy/pages/api/stripe/webhook.ts @@ -140,7 +140,11 @@ export default async function handler( const subscription = await stripe.subscriptions.retrieve( newSubscription.id, ); - if (hasEnded(subscription)) { + // A late event of an older subscription must not replace the current one. + if ( + subscription.status !== "active" && + subscription.status !== "trialing" + ) { break; }