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.$99What 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
- Choose Your Framework: Select from Astro, Next.js, or SvelteKit
- Create a Product: Sign up on Stripe and add a product
- Copy Your Key: Copy your secret key from Developers > API keys
- Add the Webhook: Point a webhook to
https://<your-domain>/api/stripe/webhook, listening tocheckout.session.completedandpayment_intent.succeeded, and copy its signing secret - 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:
// Obtain the raw body of the request to be used in Stripe for verificationconst rawBody = await request.text()const event = stripe.webhooks.constructEvent(rawBody, sig, `${getSecret('STRIPE_WEBHOOK_SIG')}`)
// Two events in Stripe point to succesful paymentif (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:
## Stripe Environment VariablesSTRIPE_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:
stripe listen --forward-to localhost:3000/api/stripe/webhookTest 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
stripeSDK
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!
