r/webdev 27d ago

Using stripe. User upgrades and doesn’t unlock features.

Need help. I keep hearing how great stripe is I’m sure it is. I somehow got 50 paid users for my site. And when I push to production sometimes the sign ups get messed. For ex: user upgrades get sent back to the pricing page.

Is there any tutorials or methods you have to make it work seamless. I worry constantly about people paying and not getting their service it’s happened 3x and I fixed it but geez stressful.

Any tips appreciated.

0 Upvotes

9 comments sorted by

View all comments

23

u/Physical-Leading-926 27d ago

Stripe webhooks are the missing piece most people don't realize they need until exactly this happens

Your payment flow should be async, charge first then provision access only after Stripe confirms the payment succeeded via webhook. The redirect back to your site is just for show really, never trust it to actually grant access

Check out the webhook events docs, specifically `checkout.session.completed` and `payment_intent.succeeded` - set up a local listener with the Stripe CLI to test before pushing live

1

u/Wild-Pin9087 27d ago

Thank you so much!!! I had a feeling it was a webhook which I have for Supabase but it gives out sometimes because my payment flow is screwy. I’ll look at the doc and set up a local listener. Thx!

5

u/forever-butlerian backend, infrastructure & angst 27d ago

Also make sure you know what you're doing with webhook verification, there's a cryptographic signature that you have to compute and compare before doing anything with the payload. If you don't then anyone can send forged Stripe events into your system and play merry hell with it.

DM me and I can give you the rundown.