mirror of
https://github.com/baptisteArno/typebot.io.git
synced 2026-06-22 21:06:40 +08:00
🔧 auto cancel at period end when subscription becomes "unpaid"
This commit is contained in:
parent
cdc177d2b9
commit
82e846baf8
@ -208,6 +208,10 @@ export const webhookHandler = async (
|
||||
previous.status !== "unpaid" &&
|
||||
!existingWorkspace.isQuarantined
|
||||
) {
|
||||
if (!subscription.cancel_at_period_end)
|
||||
await stripe.subscriptions.update(subscription.id, {
|
||||
cancel_at_period_end: true,
|
||||
});
|
||||
await prisma.workspace.updateMany({
|
||||
where: {
|
||||
id: existingWorkspace.id,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user