Sync Stripe webhook events directly into your database.
- ✅ Automatically verify webhook signatures
- ✅ Webhook callbacks
- ✅ Sync every Stripe webhook to database tables
Note: this is experimental. Stuff might be broken.
Detailed setup instructions can be found here:
https://stripe-sync.vercel.app/
Synced Webhook events may contain sensitive information. Make sure to access this data using a service role Supabase client in a protected server environment.
grant usage on schema stripe to service_role;
grant all privileges on all tables in schema stripe to service_role;
Make sure to pass the --no-verify-jwt
flat, since we want Stripe to be able to give us POST reqeusts.
supabase functions deploy stripe --no-verify-jwt
supabase secrets set --env-file ./supabase/.env
** Work in progress. Only Deno/Supabase Edge Functions are documented right now **
https://github.com/hattipjs/hattip
- ✅ Supabase Edge Functions
- ✅ Deno (including Deno Deploy)
- ✅ Node.js
- ✅ Cloudflare Workers
- ✅ Express.js
- ✅ Fastify
- ✅ Vercel Serverless Functions
- ✅ Vercel Edge Functions
- ✅ Netlify Functions
- ✅ Netlify Edge Functions
- ✅ Bun
Supabase-js cannot do cross schema joins. This may change, but in the meantime your options are:
- put all stripe tables in public (with a
stripe_
prefix) - use another database client (eg. Kysely)
Additionally, the Supabase Studio dashboard/table editor becomes very slow for large numbers of tables.
- for now, stripe-sync only works on the 2022-08-01 api version.
This project is inspired by all of the projects listed below.
-
https://github.com/supabase/stripe-sync-engine
- Needs a full blown Docker setup to run. This is a bit overkill for a simple webhook syncer.
- Can sync only a limited subset of Webhook events as of August 2022
- Only syncs to Supabase/Postgrest
-
- Their stripe sync is pretty pricey, but it's currently more mature/robust
- Not open source
- Only syncs to Postgres
- make ids primary keys
- automatically register webhooks with stripe
-
stripe_
prefix ddl option - webhook callback functions on for custom logic
- implement all stripe best practices
- make event handling idempotent (https://stripe.com/docs/webhooks/best-practices)
- check that request comes from valid ip or is local development (https://stripe.com/files/ips/ips_webhooks.json)
- next.js adapter
- fetch adapter (remix/cloudflare/deno/bun)
- add tests
- add resync
- add relations
- fix external accounts
Currently tested on every trigger supported by the Stripe CLI.
More robust tests coming soon.
Copyright (c) 2022-present, Lawrence Chen