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) }); }
2 Replies
Ham
HamOP2w ago
it looks like the stripe_subscriber_id successfully changed to the new subscription so that's working well. it's just the cancel column that isn't changing
Ping
Ping2w ago
cc @bekacru

Did you find this page helpful?