Guides

Setup Payment with Stripe

Configure Stripe payment integration for local development and production deployment with Supabase edge functions.

Setup Payment with Stripe

Local Setup

Stripe CLI

Installation of Stripe CLI is only necessary for local development environments. Manual event triggering or webhook forwarding to localhost is optional.

  1. Install Stripe CLI:

Using Homebrew:

Terminal
brew install stripe/stripe-cli/stripe
  1. Log in to Stripe CLI:
Terminal
stripe login

Follow the authentication prompts to connect your Stripe account.

Start Supabase Edge Functions

  1. Serve Edge Functions:
Terminal
npm run supabase:webhook-serve
  1. Forward Stripe events to local webhook:
Terminal
npm run stripe:listen
  1. Trigger Stripe events: Local event triggering example:
Terminal
stripe trigger <EVENT>

Alternatively, trigger events directly from the Stripe dashboard.

Deployment

For production deployment, update environment variables following these steps:

  1. Update Environment Variables:

    • Navigate to the Supabase dashboard
    • Select your project
    • Click Edge Functions in the sidebar
    • Select Manage secrets
    • Add or update edge function environment variables
    • Required environment variables:
      • BASE_SUPABASE_URL: Supabase URL
      • SERVICE_ROLE_KEY: Supabase service role key
      • STRIPE_WEBHOOK_SIGNING_SECRET: Stripe webhook signing secret
      • STRIPE_SECRET_KEY: Stripe secret key
      • STRIPE_PUBLISHABLE_KEY: Stripe publishable key
  2. Deploy Edge Function:

Terminal
npm run supabase:webhook-deploy

Payment Initialization

Two Supabase edge functions manage payment initialization:

  1. payment-data-native: Handles native application payments by verifying or creating customers, generating ephemeral keys from Stripe, creating payment intents, and returning values to trigger the native Stripe SDK.

  2. payment-data-web: Manages web application payments by verifying or creating customers, using the Stripe backend SDK with pricing and product details to generate payment URLs, then redirecting clients to complete transactions.

Products, Plans and Pricing Management

All the products, prices and their plans are managed on the Stripe dashboard. Consult Stripe's official documentation for additional guidance on product and pricing configuration.

AvatarEnda Kelly

© 2026 Enda Kelly, trading as CloudNua. All rights reserved.

Ireland