Sync Stripe to PostgreSQL
with webhooks, not just polling.
Pipe Stripe charges, customers, subscriptions, invoices, and events into PostgreSQL — described in plain English. Webhook + polling hybrid for near-real-time freshness. Source-available, self-hosted.
rsync.ai's Stripe connector calls the REST API (paginated with `starting_after` cursor) for Events, Charges, Customers, Subscriptions, Invoices, and PaymentIntents. It registers a Stripe webhook endpoint for real-time event delivery and runs a scheduled reconciliation poll to close any gaps. All rows upsert by Stripe ID — fully idempotent. Stripe metadata lands in JSONB. Works with PostgreSQL 12+, RDS, Aurora, Cloud SQL, Supabase, and Neon.
- Webhook + polling hybrid — near-real-time, no gaps
- Idempotent upserts by Stripe ID — safe to re-run
- Stripe metadata stored as JSONB with GIN index
- PII column masking at extraction time
- Source-available under Elastic License 2.0 — self-hosted
How to sync Stripe to PostgreSQL — 5 steps
From restricted API key to rows in PostgreSQL — under 10 minutes.
- 1
Generate a Stripe restricted API key
In the Stripe Dashboard, go to Developers → API keys → Create restricted key. Grant read-only access to: Charges, Customers, Subscriptions, Invoices, PaymentIntents, and Events. A restricted key limits the blast radius if credentials are ever leaked. Copy the `rk_live_…` key — rsync.ai never uses your secret key.
rk_live_… (restricted, read-only) - 2
Connect your PostgreSQL database
Provide host, port, user, password, and database name — or paste a connection string. rsync.ai supports PostgreSQL 12+, Amazon RDS for PostgreSQL, Amazon Aurora PostgreSQL, Google Cloud SQL for PostgreSQL, Azure Database for PostgreSQL, Supabase, and Neon. SSL mode `require` is the default.
postgresql://user:pass@host:5432/db - 3
Describe the sync in plain English
Type what you want: 'Sync Stripe charges, customers, subscriptions to PostgreSQL every 5 minutes.' rsync.ai discovers the Stripe resources you've granted access to, estimates record counts, and proposes PostgreSQL tables with the right column types — `BIGINT` for Stripe amounts (cents), `TIMESTAMPTZ` for Unix timestamps, `JSONB` for metadata and nested objects.
No SQL · No YAML · No DAGs - 4
rsync.ai discovers resources and proposes schema
rsync.ai calls the Stripe API list endpoints (paginated via `starting_after` cursor) to sample your data, infers column types, and generates a `CREATE TABLE` statement for each resource. Stripe metadata fields (arbitrary key-value pairs) land in a `metadata JSONB` column. Nested objects like `payment_method_details` are stored as JSONB by default, with optional column-extraction for common fields.
Auto type inference · JSONB for metadata - 5
Approve schema and pipeline runs on schedule
Review and approve the proposed PostgreSQL DDL. The pipeline runs on the cadence you set. rsync.ai uses a webhook + polling hybrid: Stripe webhooks deliver real-time event notifications, and a scheduled poll reconciles any gaps (webhooks can be missed during downtime). Rows are upserted by Stripe ID on every run, so retries are always idempotent.
Webhook + polling hybrid · idempotent upserts
Stripe → PostgreSQL schema mapping
Standard mapping rsync.ai proposes. Customize column names, types, JSONB extraction, and PII masking before approving.
| Stripe resource | PostgreSQL table | Notes | |
|---|---|---|---|
| Customer | customers | email, name, phone stored; PII columns flagged for optional masking. | |
| Charge | charges | amount in cents (BIGINT), currency, status, failure_code, payment_method_details (JSONB). | |
| PaymentIntent | payment_intents | amount, currency, status, last_payment_error (JSONB), metadata (JSONB). | |
| Subscription | subscriptions | current_period_start/end as TIMESTAMPTZ, items (JSONB), discount (JSONB). | |
| Invoice | invoices | amount_due, amount_paid, lines (JSONB), hosted_invoice_url. | |
| Event | stripe_events | Full event envelope stored for audit trail — type, created, data.object (JSONB). |
rsync.ai vs. Fivetran, Airbyte, Zapier for Stripe → PostgreSQL
What you give up — and gain — choosing rsync.ai.