You need to update the environment variable in your Supabase Edge Functions:
-
Go to Supabase Dashboard: https://supabase.com/dashboard/project/bzsjivgykaclmmovugiz
-
Navigate to Edge Functions Settings:
- Click on "Edge Functions" in the left sidebar
- Click on "Settings" or "Manage secrets"
-
Update the Secret:
- Find
SUPABASE_SERVICE_ROLE_KEY(if it exists, delete it) - Add a new secret:
SUPABASE_SECRET_KEY - Value:
sb_secret_oj0ftk52EEPO1Ymf9MQmbA_3m4r8s7A
- Find
-
Redeploy Edge Functions:
- After updating secrets, you may need to redeploy your edge functions
- Go to each function (
stripe-webhook,create-checkout-session) - Click "Deploy" or they may auto-redeploy
If you prefer to use the CLI:
# Install Supabase CLI (if not installed)
npm install -g supabase
# Login
supabase login
# Set the secret
supabase secrets set SUPABASE_SECRET_KEY=sb_secret_oj0ftk52EEPO1Ymf9MQmbA_3m4r8s7A --project-ref bzsjivgykaclmmovugiz
# Remove old secret (if exists)
supabase secrets unset SUPABASE_SERVICE_ROLE_KEY --project-ref bzsjivgykaclmmovugiz✅ Updated .env to use SUPABASE_SECRET_KEY
✅ Updated stripe-webhook/index.ts to use SUPABASE_SECRET_KEY
✅ Updated .env.example to reflect new variable name
Once you've updated the Supabase dashboard secret, test the payment flow:
- Complete a quiz
- Click "Unlock Full Report"
- Complete a test payment
- Verify the entitlement is granted