Better AuthBA
Better Auth10mo ago
V

[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",
                  }
            ]
      }
})
Solution
Can you test with setting 'successUrl' to the full url of the dashboard, "http://localhost:5173/dashboard" thank you - I believe there is url parsing logic (internally) on the options that will support using a full url as well.
Was this page helpful?