Stripe Payments in LaunchFast Starter Kits: Checkout and…

Stripe Payments in LaunchFast Starter Kits: Checkout and Webhooks Built In

4 min read
Rishi Raj JainRishi Raj JainAuthor

Stripe payments are built into every LaunchFast starter kit, across Astro, Next.js, and SvelteKit. The kits ship a checkout route that creates a Stripe Checkout session and a webhook route that gives the customer access once they have paid, so you can start charging customers with two environment variables.

LaunchFastStart shipping your product.$99

What is Stripe?

Stripe is a payment platform that lets you accept cards, wallets, and bank payments online. Unlike a merchant of record, Stripe processes payments on your behalf while you stay the seller, which gives you full control over pricing, discounts, and the checkout experience.

Why it is a good default for a new SaaS:

  • Stripe Checkout: A hosted, mobile-ready payment page, so you never handle card details yourself.
  • One-time and recurring billing: Sell lifetime licenses or subscriptions from the same checkout route.
  • Test mode: Run the whole flow with test cards and forwarded webhooks before you take real money.

Getting Started with Stripe

  1. Choose Your Framework: Select from Astro, Next.js, or SvelteKit
  2. Create a Product: Sign up on Stripe and add a product
  3. Copy Your Key: Copy your secret key from Developers > API keys
  4. Add the Webhook: Point a webhook to https://<your-domain>/api/stripe/webhook, listening to checkout.session.completed and payment_intent.succeeded, and copy its signing secret
  5. Ship: Drop the checkout button on your pricing page and start accepting payments

Adding a checkout to any page takes one component. Here is how it looks in the Astro starter kit:

---
import ButtonCheckout from '@/components/Buttons/Checkout.astro'
---
<ButtonCheckout brand_name="ACME" />

Clicking the button calls the /api/stripe/checkout route, which creates a Stripe Checkout session and redirects the user to it. To change the product, price, discounts, or custom checkout fields, edit the stripe.checkout.sessions.create call in that route. The Next.js and SvelteKit starter kits ship the same checkout and webhook routes, written in each framework’s own route format.

Handling Webhooks

Once a payment goes through, Stripe calls your webhook route. The starter kit verifies the signature against the raw request body, reads the customer’s email, and gives them access in your database:

src/pages/api/stripe/webhook.ts
// Obtain the raw body of the request to be used in Stripe for verification
const rawBody = await request.text()
const event = stripe.webhooks.constructEvent(rawBody, sig, `${getSecret('STRIPE_WEBHOOK_SIG')}`)
// Two events in Stripe point to succesful payment
if (event.type === 'checkout.session.completed' || event.type === 'payment_intent.succeeded') {
const customerEmail = event.type === 'checkout.session.completed' ? event.data.object.customer_details?.email : event.data.object.receipt_email
if (customerEmail) {
// Add the 'email' to the access list in the database
await setAccess(customerEmail, '1')
return webResponse('approved user access', 200)
}
}

From here, you can reuse the helpers the starter kit already ships with, such as sendEmail for a receipt, or store the order in your database.

Configuration

Add these values to your .env file:

Terminal window
## Stripe Environment Variables
STRIPE_SECRET_KEY="sk_live_..."
STRIPE_WEBHOOK_SIG="whsec_..."

The starter kit reads both as server-side secrets, so your secret key never reaches the browser.

Testing

In Stripe test mode, pay with the card number 4242 4242 4242 4242, any future expiry date, and any CVC. To receive webhooks on your local machine, forward them with the Stripe CLI:

Terminal window
stripe listen --forward-to localhost:3000/api/stripe/webhook

Test and live mode use separate keys and webhook secrets, so swap both when you go live.

What’s Included

Every LaunchFast starter kit with Stripe support includes:

  • ✅ Checkout Button: A drop-in component that sends customers to Stripe Checkout
  • ✅ Checkout Route: Creates a Stripe Checkout session and redirects users to it
  • ✅ Webhook Route: Signature verification and paid access through setAccess
  • ✅ Type Safety: Full TypeScript support through the official stripe SDK

Pricing

Stripe support is included in all our starter kits at no additional cost:

Other Payment Providers

Prefer a merchant of record that handles sales tax for you? Stripe sits alongside these providers, and you can switch without rewriting your purchase flow:

Get Started Today

Ready to start charging customers with Stripe?

Read the Stripe setup guide, then Get LaunchFast Starter Kit and start selling!

Continue reading

Stop rebuilding auth and billing. Start shipping your product.