Skip to content

Sync Stripe with Postgres

Stripe Sync Engine

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.

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 🟢