Skip to content

boostlink-creatorh/stripe-sync-engine

 
 

Repository files navigation

Stripe Sync Engine Monorepo

GitHub License NPM Version Docker Image Version

This monorepo contains two packages for synchronizing your Stripe account with a Postgres database:

  • @supabase/stripe-sync-engine: A TypeScript library for syncing Stripe data to Postgres, 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 /webhooks endpoint for Stripe, providing a ready-to-run service for real-time Stripe-to-Postgres sync.

Sync Stripe with Postgres


Motivation

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 Postgres database. It can be a new database, or an existing Postgres database.


How it works

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 (via the Fastify app).
  • Inserts/updates/deletes changes into the tables whenever there is a change to Stripe.

Packages

Each package has its own README with installation, configuration, and usage instructions.


Supabase Edge Function

To deploy the sync-engine to a Supabase edge function, follow this guide.

Webhook Support

  • balance.available
  • charge.captured 🟢
  • charge.expired 🟢
  • charge.failed 🟢
  • charge.pending 🟢
  • charge.refunded 🟢
  • charge.refund.updated 🟡 - For updates on all refunds, listen to refund.updated instead
  • 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
  • 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 🟢
  • issuing_authorization.request
  • issuing_card.created
  • issuing_cardholder.created
  • payment_intent.amount_capturable_updated 🟢
  • payment_intent.canceled 🟢
  • payment_intent.created 🟢
  • payment_intent.partially_refunded 🟢
  • 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 🟢

About

Sync your Stripe account to you Postgres database.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 96.0%
  • PLpgSQL 2.7%
  • Other 1.3%