Ham
BABetter Auth
•Created by Ham on 4/14/2025 in #help
Stripe 1.2.7 restore issues
Hi, I'm Sveltekit, eager to test this new function out, thanks for adding it! I haven't had success yet, I have been able to cancel subscriptions as normal and everything else works fine. The request to /api/auth/subscription/restore is still returning a 404 Not Found error. is the server-side of this implemented or is it all on the client side? The user.id is being pulled correctly here: const { data, error } = await authClient.subscription.restore({
referenceId: session.user.id
});
Thank you!!
4 replies
BABetter Auth
•Created by Ham on 4/9/2025 in #help
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) }); }
4 replies
BABetter Auth
•Created by Ham on 4/7/2025 in #help
Stripe plugin status properties full list?
Is there a comprehensive list of the status schema properties in the subscription table? It looks like better-auth manages this column so I can't customize them. I see (active, canceled, etc.) in the docs, and 'trialing' comes up in my db. Are there any others? 'inactive'? 'reset'?
5 replies
BABetter Auth
•Created by Ham on 4/5/2025 in #help
can Stripe's period_end be overwritten?
Stripe plugin and Sveltekit question. I am building an app where a free 7-day trial triggers on first log in using the better-auth stripe plugin. the period_start and period_end in the schema get correctly set on first login. When the user goes to Stripe.com to complete checkout, the period_start and period_end resets with a new timestamp so this could turn the 7-day free trial into a 14-day free trial if they complete the stripe checkout at the end of the first 7 days. I set trial_end to match the first login timestamp and I'm trying to configure period_end to trial_end instead after the redirect but it won't stick. Is there a hook or even that fires before better-auth updates the subscription? I've tried onEvent hook, onSubscriptionUpdate hook and before hooks and out of ideas.
5 replies
BABetter Auth
•Created by Ham on 2/12/2025 in #help
Ongoing Sveltekit/Drizzle ORM CORS issues

1 replies