wakit
Stripe Billing

Stripe Billing (optional)

Add subscription billing to your wakit instance with Stripe.

wakit includes optional Stripe integration for subscription management. Without Stripe secrets configured, the billing functions are inert.

Edge Functions

FunctionPurpose
stripe-checkoutCreates Stripe Checkout sessions for plan upgrades
stripe-webhookReceives Stripe events and updates billing in the database
stripe-portalRedirects to Stripe Customer Portal for self-service

Setup

1. Create Stripe products

Create products and monthly recurring prices in Stripe Dashboard:

Starter — $25/month
Pro — $249/month

2. Create a webhook endpoint

In Stripe Dashboard > Webhooks, create an endpoint:

  • URL: https://{PROJECT_ID}.supabase.co/functions/v1/stripe-webhook
  • Events: checkout.session.completed, customer.subscription.updated, customer.subscription.deleted, invoice.payment_succeeded, invoice.payment_failed

3. Set secrets

Add these to Supabase Edge Function secrets:

SecretDescription
STRIPE_SECRET_KEYsk_live_... or sk_test_...
STRIPE_PUBLISHABLE_KEYpk_live_... or pk_test_...
STRIPE_WEBHOOK_SECRETwhsec_... from the webhook endpoint
STRIPE_STARTER_PRICE_IDprice_... for the Starter plan
STRIPE_PRO_PRICE_IDprice_... for the Pro plan

4. Deploy without JWT

npx supabase functions deploy stripe-webhook --no-verify-jwt

Usage

From the frontend, call the Edge Functions:

Upgrade plan

const { data } = await supabase.functions.invoke('stripe-checkout', {
  body: {
    plan_id: 'starter',
    organization_id: orgId,
    success_url: window.location.origin + '/stats/quotas',
    cancel_url: window.location.origin + '/stats/quotas',
  },
});
// Redirect to Stripe Checkout
window.location.href = data.url;

Manage subscription

const { data } = await supabase.functions.invoke('stripe-portal', {
  body: {
    organization_id: orgId,
    return_url: window.location.origin + '/stats/quotas',
  },
});
// Redirect to Stripe Customer Portal
window.location.href = data.url;

Billing tiers

The billing tiers (names, prices, limits) are fully configurable via the billing schema. Customize them for your deployment in supabase/seed.sql.

On this page