mickasmt / next-saas-stripe-starter

Open-source SaaS Starter with User Roles & Admin Panel. Built using Next.js 14, Prisma, Neon, Auth.js v5, Resend, React Email, Shadcn/ui, Stripe, Server Actions.
https://next-saas-stripe-starter.vercel.app
MIT License
1.95k stars 354 forks source link

Subscription Plan is not being saved #52

Closed erwinowak closed 3 months ago

erwinowak commented 4 months ago

Why is my subscription plan still not being signed up after paying? I don't know what I'm doing wrong anymore.

Even when I manually add stripeCustomerId, stripeSubscriptionId, stripePriceId, stripeCurrentPeriodEnd it still shows that You are currently on the Starter plan.

For Beginners

mickasmt commented 4 months ago

Hi @erwinowak. Did you create your products on your stripe account and modify the environment variables as in this step of the documentation?

Try checking with a console.log the different values ​​returned by getUserSubscriptionPlan in dashboard/billing/page.tsx. The function makes comparisons with price ids. If they don't match what you save in your database, the starter plan will still be returned.

erwinowak commented 3 months ago

I had a bad webhook address, I set 'stripe listen --forward-to localhost:3000/api/webhooks/stripe' I already managed it, I had to edit the data in https://dashboard.stripe.com/test/settings/billing/portal

Could you please edit the documentation and add information that you need to add the following webhook address: 'localhost:3000/api/webhooks/stripe'