Back to all articles

Accept Payments with Stripe

15 min readJanuary 13, 2026By Spawned Team

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

  1. Create a Stripe account at stripe.com
  2. Get your API keys from the Developers section
  3. 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:

  1. Switch from test to live API keys
  2. Complete Stripe account verification
  3. 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

Ready to try it?

Build your first app in a few minutes.

Start Building