DEV Community

LaunchAlly
LaunchAlly

Posted on

How I Integrated Stripe Subscriptions into My SaaS (and the Bugs That Nearly Drove Me Crazy)

When I started building LaunchAlly, adding Stripe subscriptions sounded like one of the easiest tasks on my roadmap.

It wasn't.

I thought I'd create a Checkout Session, redirect the user, and I'd be done in an afternoon. Instead, I spent hours debugging authentication, API modes, Checkout configuration, and deployment issues before everything finally clicked.

Here are the biggest lessons I learned.

1. Test mode vs Live mode

This was probably the most confusing error I encountered.

I kept seeing:

No such price exists, but a similar object exists in live mode.

The problem wasn't my code.

My server was using a test secret key while my Checkout Session referenced a live price ID.

Stripe separates test and live data completely. A live price can only be used with live API keys, and test prices only work with test keys.

2. Never trust the frontend

Originally I sent the user's email from React to my API.

Later I realised that's not ideal.

Instead, I now verify the Supabase session inside the API, retrieve the authenticated user, and create the Checkout Session using the verified email.

The client never decides who the customer is.

3. Webhooks matter

Creating a subscription isn't enough.

Your database needs to know when someone:

subscribes
renews
cancels
updates their subscription

That's exactly what Stripe webhooks are for.

Once I connected them, LaunchAlly could automatically switch users between Free and Pro without any manual work.

4. Enforce limits on the backend

One mistake I nearly made was relying on the frontend to enforce plan limits.

Instead, every important restriction now lives in the API.

For example:

Free users can only create one project.
Free teams are limited to three members.
Free users can only deploy five times per month.

Even if someone modifies the frontend, the backend still rejects anything beyond those limits.

5. Billing is more than payments

Once payments worked, I realised billing also includes:

managing subscriptions
updating payment methods
invoices
cancellations

Rather than building all of that myself, I'll let Stripe handle it through the Customer Portal.

Final thoughts

Stripe is incredibly powerful, but there are lots of small details that can trip you up.

Looking back, most of my bugs came from configuration rather than code.

Now that subscriptions are working, LaunchAlly finally has a real SaaS billing system, and I can focus on building features instead of payment infrastructure.

Sometimes the hardest part of shipping isn't writing codeโ€”it's understanding how all the pieces fit together.

Top comments (0)