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
| Function | Purpose |
|---|---|
stripe-checkout | Creates Stripe Checkout sessions for plan upgrades |
stripe-webhook | Receives Stripe events and updates billing in the database |
stripe-portal | Redirects 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/month2. 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:
| Secret | Description |
|---|---|
STRIPE_SECRET_KEY | sk_live_... or sk_test_... |
STRIPE_PUBLISHABLE_KEY | pk_live_... or pk_test_... |
STRIPE_WEBHOOK_SECRET | whsec_... from the webhook endpoint |
STRIPE_STARTER_PRICE_ID | price_... for the Starter plan |
STRIPE_PRO_PRICE_ID | price_... for the Pro plan |
4. Deploy without JWT
npx supabase functions deploy stripe-webhook --no-verify-jwtUsage
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.