Setup
We'll need to configure Stripe to handle test payments. If you don't already have a Stripe account, create one now.
For the following steps, make sure you have the "Test Mode" toggle switched on:
- Create a stripe account and set it up
- Create a product
- Go to portal settings and click "Save Changes"
- Go to Supabase dashboard > Edge Functions and copy the
stripe_webhooks
URL. It should look something like below:
- Add stripe webhook,
- Click
Select events
under theSelect events to listen to
heading. - Click
Select all events
in theSelect events to send
section. - Copy
Signing secret
as we'll need that in the next step (e.gwhsec_xxx
) - Get your Stripe API secret key and update
STRIPE_SECRET_KEY
in.env
- Get the signing webhook signing secret and update
STRIPE_WEBHOOK_SIGNING_SECRET
in.env
- Set your secrets in production
supabase secrets set --env-file .env
info
You can follow steps 1-7 in the Stripe test environment to have your local environment use the stripe test environment. Update .env.local
instead of .env
.
note
After setting up the webhooks, you can run the command below to do an initial sync between your supabase and stripe database
deno run --env -A supabase/functions/_scripts/sync-stripe.ts