This monorepo contains two packages for synchronizing your Stripe account with a PostgreSQL database:
@supabase/stripe-sync-engine: A TypeScript library for syncing Stripe data to PostgreSQL, designed for integration into your own Node.js backend or serverless environment.stripe-sync-fastify: A Fastify-based server and Docker image that exposes a/webhooksendpoint for Stripe, providing a ready-to-run service for real-time Stripe-to-PostgreSQL sync.
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 project synchronizes your Stripe account to a PostgreSQL database. It can be a new database, or an existing PostgreSQL database.
- Creates a new schema
stripein a PostgreSQL database, with tables and columns matching Stripe. - Exposes a
/webhooksendpoint that listens to any Stripe webhooks (via the Fastify app). - Inserts, updates, or deletes changes into the tables whenever there is a change to Stripe.
Note: If other PostgreSQL users need access to the
stripeschema, grant them privileges:GRANT USAGE ON SCHEMA stripe TO your_user; GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA stripe TO your_user;
Each package has its own README with installation, configuration, and usage instructions.
To deploy the sync-engine to a Supabase Edge Function, follow this guide.
-
balance.available -
charge.captured๐ข -
charge.expired๐ข -
charge.failed๐ข -
charge.pending๐ข -
charge.refunded๐ข -
charge.refund.updated๐ก - For updates on all refunds, listen torefund.updatedinstead -
charge.succeeded๐ข -
charge.updated๐ข -
charge.dispute.closed๐ข -
charge.dispute.created๐ข -
charge.dispute.funds_reinstated๐ข -
charge.dispute.funds_withdrawn๐ข -
charge.dispute.updated๐ข -
checkout.session.async_payment_failed๐ข -
checkout.session.async_payment_succeeded๐ข -
checkout.session.completed๐ข -
checkout.session.expired๐ข -
credit_note.created๐ข -
credit_note.updated๐ข -
credit_note.voided๐ข -
customer.created๐ข -
customer.deleted๐ข -
customer.source.created -
customer.source.updated -
customer.subscription.created๐ข -
customer.subscription.deleted๐ข -
customer.subscription.paused๐ข -
customer.subscription.pending_update_applied๐ข -
customer.subscription.pending_update_expired๐ข -
customer.subscription.resumed๐ข -
customer.subscription.trial_will_end๐ข -
customer.subscription.updated๐ข -
customer.tax_id.created๐ข -
customer.tax_id.deleted๐ข -
customer.tax_id.updated๐ข -
customer.updated๐ข -
invoice.created๐ข -
invoice.deleted๐ข -
invoice.finalized๐ข -
invoice.finalization_failed๐ข -
invoice.marked_uncollectible๐ข -
invoice.paid๐ข -
invoice.payment_action_required๐ข -
invoice.payment_failed๐ข -
invoice.payment_succeeded๐ข -
invoice.sent๐ข -
invoice.upcoming๐ด - Event has no id and cannot be processed -
invoice.updated๐ข -
invoice.overdue๐ข -
invoice.overpaid๐ข -
invoice.will_be_due๐ข -
invoice.voided๐ข -
invoice_payment.paid๐ข -
issuing_authorization.request -
issuing_card.created -
issuing_cardholder.created -
payment_intent.amount_capturable_updated๐ข -
payment_intent.canceled๐ข -
payment_intent.created๐ข -
payment_intent.partially_funded๐ข -
payment_intent.payment_failed๐ข -
payment_intent.processing๐ข -
payment_intent.requires_action๐ข -
payment_intent.succeeded๐ข -
payment_method.attached๐ข -
payment_method.automatically_updated๐ข -
payment_method.detached๐ข -
payment_method.updated๐ข -
plan.created๐ข -
plan.deleted๐ข -
plan.updated๐ข -
price.created๐ข -
price.deleted๐ข -
price.updated๐ข -
product.created๐ข -
product.deleted๐ข -
product.updated๐ข -
radar.early_fraud_warning.created๐ข -
radar.early_fraud_warning.updated๐ข -
refund.created๐ข -
refund.failed๐ข -
refund.updated๐ข -
review.opened๐ข -
review.closed๐ข -
setup_intent.canceled๐ข -
setup_intent.created๐ข -
setup_intent.requires_action๐ข -
setup_intent.setup_failed๐ข -
setup_intent.succeeded๐ข -
subscription_schedule.aborted๐ข -
subscription_schedule.canceled๐ข -
subscription_schedule.completed๐ข -
subscription_schedule.created๐ข -
subscription_schedule.expiring๐ข -
subscription_schedule.released๐ข -
subscription_schedule.updated๐ข -
entitlements.active_entitlement_summary.updated๐ข

