Stripe Sync Engine
Continuously synchronizes a Stripe account to a Postgres database.
Sometimes you want to analyze your billing data using SQL. Even more importantly, you want to join your billing data to your product/business data.
This server synchronizes your Stripe account to a Postgres database. It can be a new database, or an existing Postgres database.
How it works
- Creates a new schema
stripe
in a Postgres database, with tables & columns matching Stripe. - Exposes a
/webhooks
endpoint that listens to any Stripe webhooks. - Inserts/updates/deletes changes into the tables whenever there is a change to Stripe.
Not implemented
- This will not do an initial load of existing Stripe data. You should use CSV loads for this. We might implement this in the future.
- We are progressively working through webhooks.
Usage
- Update your Stripe account with all valid webhooks and get the webhook secret
mv .env.sample .env
and then rename all the variables- Make sure the database URL has search_path
stripe
. eg:DATABASE_URL=postgres://postgres:postgres@hostname:5432/postgres?sslmode=disable&search_path=stripe
- Deploy the docker image to your favourite hosting service and expose port
8080
- eg:
docker run -e PORT=8080 --env-file .env supabase/stripe-sync-engine
- This will automatically run any migrations on your database
- eg:
- Point your Stripe webooks to your deployed app.