Payment

Set up Stripe for receiving money.

Basic Setup

  1. Go to stripe.com, sign up and complete the verification process... see you in few minutes.
  2. In the Stripe Dashboard, go to Developers → API keys, copy your publishable key and secret key
  3. Add them to .env file:
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="..."
STRIPE_SECRET_KEY="..."
  1. Go to settings/emails and turn on successful payments for customers Supabase Prisma Connection

  2. Navigate to product and create a product

  3. Fill in the necessary details (name, description, etc.) and set up the pricing (no worries everything can be change at any time).

Webhooks

Webhooks allow Stripe to notify your application when events happen in your account:

For Local Development

  1. Install the Stripe CLI: Installation Guide
  2. Login to your Stripe account via the CLI:
stripe login
  1. Start forwarding events to your local server:
stripe listen --forward-to http://localhost:3000/api/webhooks/stripe
  1. Copy the webhook signing secret displayed by the CLI and add it to your .env file:
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret

For Production

  1. In the Stripe Dashboard, go to Developers → Webhooks
  2. Click "Add endpoint"
  3. Enter your webhook URL: https://your-domain.com/api/webhooks/stripe
  4. Select the events you want to receive (at minimum: checkout.session.completed, customer.subscription.created, customer.subscription.updated, customer.subscription.deleted)
  5. Copy the signing secret and update your production environment variables

On this page