Stripe Integration Guide

This guide will walk you through setting up Stripe for payment processing for one-time payments.

Create a Stripe Account

Sign up for Stripe if you haven't already
  1. Visit stripe.com
  2. Click "Start now" or "Sign up"
  3. Fill in your business information
  4. Verify your email address
  5. Complete your account setup

Get Your API Keys

You'll need both publishable and secret keys

1. Access your Stripe Dashboard

Log into your Stripe account and navigate to the Dashboard

2. Find API Keys

In the left sidebar, click "Developers" → "API keys"

3. Copy Your Keys

Publishable Key: Starts with pk_test_ (for test mode)
This is safe to expose in your frontend code
Secret Key: Starts with sk_test_ (for test mode)
Keep this secret! Never expose in frontend code

Set Up Environment Variables

Add your Stripe keys to your project

Create a .env file in your project root:

# Stripe Configuration
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_your_publishable_key_here
STRIPE_SECRET_KEY=sk_test_your_secret_key_here

Set Up Products and Prices

Create your one-time payment products in Stripe

1. Create Products

In Stripe Dashboard: Products → Create product

  • Name: e.g., "Starter Plan", "Pro Plan"
  • Description: Brief description of what's included

2. Add Pricing

For each product, create pricing:

  • Pricing model: Standard pricing
  • Price: Set your amount (e.g., $199)
  • Type: One-time payment
  • Currency: USD (or your preferred currency)

3. Copy Price IDs

You'll need these price IDs (starting with price_) in your code.

Test Your Integration

Verify everything is working correctly
Test Credit Card Numbers:
Success: 4242 4242 4242 4242
Declined: 4000 0000 0000 0002
Use any future expiration date and any CVC
Webhook Testing:
Use Stripe CLI for local webhook testing:
stripe listen --forward-to localhost:3000/webhooks

Going Live

When you're ready for production
  1. Complete your Stripe account verification
  2. Switch to "Live" mode in your Stripe dashboard
  3. Get your live API keys (start with pk_live_ and sk_live_)
  4. Update your environment variables with live keys
  5. Set up live webhooks pointing to your production domain
  6. Test thoroughly with small amounts first