Accept Payments with Stripe
Set up Stripe to charge users. Works for one-time payments and subscriptions.
Stripe Integration Options
Stripe supports different payment models:
- One-time payments - Charge once for a product or service
- Subscriptions - Recurring monthly or yearly billing
- Usage-based - Charge based on how much they use
Setting Up Stripe
- Create a Stripe account at stripe.com
- Get your API keys from the Developers section
- For subscriptions, create Products and Prices in the Stripe dashboard
Add your keys to environment variables:
STRIPE_SECRET_KEY=sk_live_...
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_live_...
Adding Subscriptions
Ask the AI:
"Add a pricing page with three tiers: Free, Pro at $19/month, and Team at $49/month. Use Stripe for payments."
This creates:
- Pricing table with feature comparison
- Checkout flow that redirects to Stripe
- Webhook handling for subscription events
- Logic to gate features by plan
One-Time Payments
For simpler products:
"Add a buy button that charges $99 for lifetime access"
The AI creates a checkout button that opens Stripe's hosted payment page.
Handling Webhooks
Stripe sends events when things happen (payment succeeded, subscription canceled, etc.). The AI sets up handlers:
- Payment success → Grant access
- Subscription canceled → Revoke access
- Payment failed → Send warning email
Testing Payments
Use Stripe's test mode first. Test card number: 4242 4242 4242 4242 with any future expiry and any CVC.
Going Live
When ready:
- Switch from test to live API keys
- Complete Stripe account verification
- Test one real transaction with a small amount
Common Additions
"Show a 'Manage Subscription' button that opens Stripe's customer portal"
"Add usage tracking so I can bill based on API calls"
"Send an email when someone subscribes"
Related Articles
Build Your First App with AI in Under 10 Minutes
Walk through building your first web app using Spawned. No coding experience needed, just describe what you want.
Make Your Landing Page Look Good
How to change colors, fonts, and layout to match your brand. Simple tweaks that make a big difference.
Connect Your Custom Domain
Point your domain to your Spawned app. Covers DNS setup and getting your SSL certificate working.
Ready to try it?
Build your first app in a few minutes.
Start Building