Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 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 /webhooks endpoint for Stripe, providing a ready-to-run service for real-time Stripe-to-PostgreSQL sync.

Sync Stripe with PostgreSQL


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


How it works

How it works

  • Creates a new schema stripe in a PostgreSQL database, with tables and columns matching Stripe.
  • Exposes a /webhooks endpoint 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 stripe schema, grant them privileges:

GRANT USAGE ON SCHEMA stripe TO your_user;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA stripe TO your_user;

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 🟒
  • 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_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 🟒
  • entitlements.active_entitlement_summary.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.5%
  • PLpgSQL 1.9%
  • Other 1.6%

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /