Skip to content

Commit

Permalink
fix(webhook): Add subscription update after cancellation
Browse files Browse the repository at this point in the history
Add upsertSubscription call after handleSubscriptionCancellation to ensure subscription data is properly synchronized in the database when a subscription is canceled.

This ensures our system maintains accurate subscription state after cancellation processing.
gentamura committed Jan 7, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent edfa1aa commit 6ddee1e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/webhooks/stripe/route.ts
Original file line number Diff line number Diff line change
@@ -83,10 +83,11 @@ export async function POST(req: Request) {
);
}
await handleSubscriptionCancellation(event.data.object);
await upsertSubscription(event.data.object.id);
break;

case "invoice.created": {
console.log(`🔔 Invoice created: ${event.data.object.id}`);
case "invoice.created":
console.log(`🔔 Invoice created: ${event.data.object.id}`);

await handleInvoiceCreation(event.data.object);

@@ -95,7 +96,6 @@ export async function POST(req: Request) {
await handleSubscriptionCycleInvoice(event.data.object);
}
break;
}

default:
throw new Error("Unhandled relevant event!");

0 comments on commit 6ddee1e

Please sign in to comment.