ashutoshpw/stripe-sync-engine
Overview
This skill helps you import historical Stripe data into a PostgreSQL schema using stripe-sync-engine. It provides recommended scripts, API endpoints, and strategies for small and very large accounts so you can reliably backfill customers, charges, subscriptions, invoices, and other Stripe objects. Use it to fill gaps, migrate data, or bootstrap analytics and billing tables.
How this skill works
The skill uses the stripe-sync-engine client to run syncBackfill and syncSingleEntity operations against Stripe’s API and write normalized rows to a configured Postgres schema. You can run a one-off script, trigger backfills via an API endpoint, or iterate by date or object type to avoid timeouts and rate limits. Configuration options let you revalidate critical objects via the Stripe API and include related entities for FK integrity.
When to use it
- You need to import historical Stripe records into Postgres for reporting or migration.
- You want to backfill after enabling stripe-sync-engine or after running migrations.
- You need to refresh or re-sync single Stripe objects by ID.
- Your Stripe account is large and requires chunked backfills to avoid timeouts.
- You want programmatic control to run backfills from scripts or server endpoints.
Best practices
- Verify stripe-sync-engine is installed and DB migrations are applied before backfilling.
- Start with a limited date range or single object type to validate results before broad backfills.
- For accounts with 10,000+ objects, backfill day-by-day or object-by-object to prevent timeouts and reduce retries.
- Enable backfillRelatedEntities when you need complete foreign-keyed data relationships.
- Revalidate critical objects (customer, subscription, invoice, payment_intent) directly from the Stripe API to avoid stale webhook payloads.
Example use cases
- Run a script to backfill all Stripe data created since a given Unix timestamp into the stripe schema.
- Expose a POST API endpoint to trigger on-demand backfills from an internal dashboard.
- Backfill a full year by iterating day-by-day to safely import large volumes without hitting timeouts.
- Backfill only product and price objects when importing a product catalog migration.
- Sync a single Stripe object by ID to repair or refresh a specific record after discrepancies are found.
FAQ
Decide based on business need: full history for migrations, last year for reporting, or a narrow window to validate setup. Use Unix timestamps for the created filter.
What if backfill times out or hits rate limits?
Split work into smaller ranges (daily/weekly) or run object-by-object. stripe-sync-engine respects Stripe rate limits; schedule during off-peak hours and increase timeouts for serverless functions if needed.
4 skills
This skill helps you backfill historical Stripe data into PostgreSQL using stripe-sync-engine for efficient, scalable data recovery.
This skill helps you query Stripe synced data efficiently from PostgreSQL, optimizing joins, filters, and ORM integration.
This skill helps diagnose and fix Stripe sync engine issues, guiding you through errors, environment checks, and webhook and migration troubleshooting.
This skill helps you set up and run Stripe Sync Engine migrations in PostgreSQL, ensuring stripe schema and migrations table are created.