Payments
Handle payments such as one-time, or recurring payments with Stripe..
Table of Contents
Overview
The Payments Plugin lets you integrate Stripe into your FastStartup project quickly and easily.
It handles:
- Stripe webhook events
- Creating subscription checkout sessions
If you need to monetize your SaaS with subscriptions or one-time payments, this plugin has you covered.
Key Features
- Built-in Stripe integration.
- Supports subscription-based payments.
- Webhook already setup.
- Ready to use in FastStartup monetization templates.
Use Cases
- Subscription Plans: Offer premium access for different user roles.
- Monetize Fast: Connect Stripe and start accepting payments in minutes.
- Webhooks: Automate Stripe events like successful payments or subscription cancellations.
If you're using the monetization template, this plugin works out-of-the-box.
Getting Started
-
Set up your Stripe keys:
- Go to your Stripe dashboard and get these keys:
STRIPE_PUBLISHABLE_KEY
STRIPE_SECRET_KEY
STRIPE_WEBHOOK_SECRET
- Go to your Stripe dashboard and get these keys:
-
Add environment variables:
STRIPE_PUBLISHABLE_KEY=your-publishable-key STRIPE_SECRET_KEY=your-secret-key STRIPE_WEBHOOK_SECRET=your-webhook-secret
-
Register your webhook:
- Visit the Stripe Webhook Docs.
- Set the webhook URL to
https://<your domain>/stripe/webhook
in Stripe.
-
Use the plugin in your code:
import { createSubscriptionCheckoutSession } from "@/plugins/payments";
createSubscriptionCheckoutSession
creates Stripe checkout sessions.
-
Test and Deploy:
- Run locally, test payments with Stripe test cards, and deploy when ready.
-
After Successful Payment
- User is upgraded to the entered role when creating the checkout session.
API Overview
Function | Description |
---|---|
webhookHandler | Handles incoming Stripe webhook events. |
createSubscriptionCheckoutSession | Creates a Stripe checkout session for subscriptions. |
Comparison to Alternatives
Instead of building a Stripe integration from scratch, this plugin saves you:
- Time: No need to configure Stripe events manually.
- Errors: Built-in webhook handling ensures reliability.
- Setup Hassle: Environment variables and templates simplify the process.
Other tools like Paddle or Lemon Squeezy work for some, but this plugin is tailor-made for Stripe and FastStartup projects.
FAQ
1. How do I test Stripe payments?
Use Stripe test cards. Visit Stripe's Testing Guide for card details.
2. What happens if the webhook fails?
Stripe retries webhooks automatically. Make sure your webhook endpoint is correctly set up.
3. Can I use this for one-time payments?
Yes. While the main focus is subscriptions, you can use Stripe checkout sessions for one-time purchases.
4. Is the plugin customizable?
Yes. You can customize checkout sessions, user roles, and success/cancel pages.
Start accepting payments with Stripe in your FastStartup project today!
Build, Launch, and Grow Your SaaS
Get everything you need to launch your SaaS and land your first paying user—starting today.