Skip to content

Commit cdc177d

Browse files
committed
🔧 Remove cancel at period end if subscription is paid
1 parent 4d79c09 commit cdc177d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/billing/src/api/webhookHandler.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,11 @@ export const webhookHandler = async (
226226
(previous.status === "past_due" || previous?.status === "unpaid") &&
227227
existingWorkspace.isPastDue
228228
) {
229+
if (subscription.cancel_at_period_end)
230+
await stripe.subscriptions.update(subscription.id, {
231+
cancel_at_period_end: false,
232+
});
233+
229234
await prisma.workspace.updateMany({
230235
where: {
231236
id: existingWorkspace.id,

0 commit comments

Comments
 (0)