Help with Supabase x Stripe Setup - I am SO stuck...
I have a web-app, and I'm trying to setup Stripe integrations for it with Supabase and am incredibly stuck. I work mostly with infrastructure so have had AI help me a lot with this project so far, but I can't for the life of my wrap my head around this edge function and webhook setup, and keep getting a variety of errors. Front end to Supabase is ok, but then I get varous errors depending on my fixes. 401, 500, etc, etc.
5 Replies
If you have seen that the stripe guide here https://supabase.com/docs/guides/functions/examples/stripe-webhooks then the main other thing i would say for edge functions is make sure you have verify jwt off for the edge functions in the details section which would block requests for webhooks
Handling Stripe Webhooks | Supabase Docs
Handling signed Stripe Webhooks with Edge Functions.
if you have any error logs or specific things you want help with then that would help
I think my problem is that it's the talking between all three, the frontend, backend and stripe, and it's causing me a ton of confusion - (Im sure it doesn't help that I'm trying to manipulate code that was originally created by loveable, and I'm not a developer...) the problem keeps changing, but it's like whack-a-mole... for instance, I got it working with my test stripe environment! I could create an account, buy a subscription, all the approriate tables in supabase changed accordingly - great! But then I tried making it so that if a user has a subscription, the buttons on the front-end change to "Manage" instead of "Purchase" and send them to the stripe customer portal, which seems to be broken, and has broken the previous setup!
I think if you are primarily using Lovable to edit things then their discord might be able to help bit more on that front. If you have a peice of code of an edge function error then happy to take a look at it
Thinking a bit more on this, what you likely need is a column in a profiles table called
stripe_subscription_id which is populated after a subscription is created. Your frontend can condition on the existence of this column value to determine which button is shown and where to redirect to after click. Your stripe_subscription_id can be updated via a stripe webhook after a subscription is createdThanks man, I really appreciate that - I did use the stripe setup script in supabase which did all of that for me which was great
I actually got pretty frustrated with Stripe and googled peoples experiences with it, and now I've come across paddle which is actually more what I'm after so technically you can close this if you want, but I'm already seriously struggling with integrating paddle so there's that :supafire: