Vivillies
Vivillies
BABetter Auth
Created by Vivillies on 3/6/2025 in #help
[SvelteKit] Stripe checkout redirects to /api/auth/dashboard
I made a checkout which is being initiated within a /dashboard route. Once finalized/succeeded, the stripe plugin redirects the users to a /api/auth/dashboard route., although it should go to /dashboard automatically Current setup:
stripe({
stripeClient: StripeSDK,
stripeWebhookSecret: STRIPE_WEBHOOK_SECRET,
createCustomerOnSignUp: true,
schema: {
subscription: {
modelName: "stripeSubscriptions",
fields: {
plan: "planName",
status: "status"
},
}
},
onCustomerCreate: async({ customer, stripeCustomer, user }, request) => {
await userCollection.updateOne(
{ _id: new ObjectId(user.id) },
{ $set: { customerId: stripeCustomer.id } }
)
},
subscription: {
enabled: true,
plans: [
{
name: "basic",
priceId: "price_1",
}
]
}
})
stripe({
stripeClient: StripeSDK,
stripeWebhookSecret: STRIPE_WEBHOOK_SECRET,
createCustomerOnSignUp: true,
schema: {
subscription: {
modelName: "stripeSubscriptions",
fields: {
plan: "planName",
status: "status"
},
}
},
onCustomerCreate: async({ customer, stripeCustomer, user }, request) => {
await userCollection.updateOne(
{ _id: new ObjectId(user.id) },
{ $set: { customerId: stripeCustomer.id } }
)
},
subscription: {
enabled: true,
plans: [
{
name: "basic",
priceId: "price_1",
}
]
}
})
10 replies