stripe subscription edge case question cancel_at_period_end
Hi, I'm working in SvelteKit with the new Stripe plugin and drizzle adapter. All is smooth but I'm testing edge cases where a customer subscribes, cancels and resubscribes. the "cancel_at_period_end" doesn't change to false or null after the resubscription. Is onSubscriptionUpdate hook the best bet? I haven't gotten this to work if so:
onSubscriptionComplete: async ({ subscription: subscriptionData }) => {
await db .update(subscription) .set({ status: 'active', cancelAtPeriodEnd: false }) .where(eq(subscription.id, subscriptionData.id));
const updated = await db.query.subscription.findFirst({ where: eq(subscription.id, subscriptionData.id) }); }
await db .update(subscription) .set({ status: 'active', cancelAtPeriodEnd: false }) .where(eq(subscription.id, subscriptionData.id));
const updated = await db.query.subscription.findFirst({ where: eq(subscription.id, subscriptionData.id) }); }
2 Replies