Skip to content

stripe/sync-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

323 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

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_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 ๐ŸŸข

Packages

 
 
 

Contributors