Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

Clear pause fields (pausedAt, pauseStartsAt, pauseEndsAt) and cancelledAt when purchasing a new plan or downgrading to free

Cursor Agentd6cafe426e3b
diff --git a/ee/stripe/webhooks/checkout-session-completed.ts b/ee/stripe/webhooks/checkout-session-completed.ts
index feeea92f..0f5d440d 100644
--- a/ee/stripe/webhooks/checkout-session-completed.ts
+++ b/ee/stripe/webhooks/checkout-session-completed.ts
@@ -94,6 +94,11 @@ export async function checkoutSessionCompleted(
startsAt: subscriptionStart,
endsAt: subscriptionEnd,
limits: planLimits,
+ // Clear cancellation and pause state when purchasing a new plan
+ cancelledAt: null,
+ pausedAt: null,
+ pauseStartsAt: null,
+ pauseEndsAt: null,
},
select: {
id: true,
diff --git a/ee/stripe/webhooks/customer-subscription-deleted.ts b/ee/stripe/webhooks/customer-subscription-deleted.ts
index cdb309bf..3316631b 100644
--- a/ee/stripe/webhooks/customer-subscription-deleted.ts
+++ b/ee/stripe/webhooks/customer-subscription-deleted.ts
@@ -32,6 +32,11 @@ export async function customerSubscriptionDeleted(
endsAt: null,
startsAt: null,
limits: freePlanLimits,
+ // Clear cancellation and pause state when downgrading to free
+ cancelledAt: null,
+ pausedAt: null,
+ pauseStartsAt: null,
+ pauseEndsAt: null,
},
select: { id: true },
});