moinulmoin / chadnext

ChadNext - Quick Starter Template for your Next project includes Next.js 14 App router, Shadcn UI, LuciaAuth, Prisma, Server Actions, Stripe, Internationalization and more.
https://chadnext.moinulmoin.com
MIT License
895 stars 85 forks source link

User subscription information does not update in database #182

Closed graham-fleming closed 6 months ago

graham-fleming commented 7 months ago

When a user upgrades to a pro account, the Stripe session appears to be successful and the subscription is created.

But the information in the database does not update, only the "Updated at" and the other fields are blank.

Stripe current period end
-
Stripe customer id
-
Stripe price id
-
Stripe subscription id
-
Updated at
02/08/2024 7:10:16 PM

Is this a known problem?

moinulmoin commented 7 months ago

yes, will fix it for sure, some redirecting is causing this

graham-fleming commented 6 months ago

Is there a fix?

With Vercel the default domain setup included the "www" redirecting everything to it

Should the domain for NEXT_PUBLIC_APP_URL and stripe webhook url include the "www"?

Where should I look to check for errors?

HTTP status code 308 (Permanent Redirect)

image
graham-fleming commented 6 months ago

Adding a trailing slash to the Stripe webhook URL in the stripe dashboard fixed the problem

moinulmoin commented 6 months ago

Genius, Let me check!

moinulmoin commented 6 months ago

thanks, it is solved now.

graham-fleming commented 6 months ago

Great! good to hear. Possibly related to the trailingSlash: true in next.config.js

mikeXdev commented 5 months ago

Adding a trailing slash to the Stripe webhook URL in the stripe dashboard fixed the problem

May I know how did you fix this? I am running webhook locally.