stripe-sync-webhook
π―Skillfrom ashutoshpw/stripe-sync-engine
Synchronizes Stripe webhook events in real-time by processing incoming webhook payloads and updating corresponding records in a PostgreSQL database.
Installation
npx skills add https://github.com/ashutoshpw/stripe-sync-engine --skill stripe-sync-webhookSkill Details
Overview
# Stripe Sync Engine
[](https://github.com/ashutoshpw/stripe-sync-engine/actions/workflows/test.yml)
A TypeScript library to synchronize Stripe data into a PostgreSQL database, designed for use in Node.js backends and serverless environments.
Features
- Sync Stripe objects (customers, invoices, products, etc.) to your PostgreSQL database.
- Handles Stripe webhooks for real-time updates.
- Supports backfilling and entity revalidation.
Installation
```sh
npm install stripe-sync-engine stripe
# or
pnpm add stripe-sync-engine stripe
# or
yarn add stripe-sync-engine stripe
# or
bun add stripe-sync-engine stripe
```
For Deno, leverage npm specifiers:
```ts
import { StripeSync } from 'npm:stripe-sync-engine@latest'
```
Usage
```ts
import { StripeSync } from 'stripe-sync-engine'
const sync = new StripeSync({
poolConfig: {
connectionString: 'postgres://user:pass@host:port/db',
max: 10, // Maximum number of connections
},
stripeSecretKey: 'sk_test_...',
stripeWebhookSecret: 'whsec_...',
})
// Example: process a Stripe webhook
await sync.processWebhook(payload, signature)
```
Configuration
| Option | Type | Description |
| ------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| databaseUrl | string | Deprecated: Use poolConfig with a connection string instead. |
| schema | string | Database schema name (default: stripe) |
| tablePrefix | string | Optional prefix for all table names. An underscore is auto-appended if not present. Example: 'billing' results in billing_products, billing_customers, etc. (default: empty string) |
| stripeSecretKey | string | Stripe secret key |
| stripeWebhookSecret | string | Stripe webhook signing secret |
| stripeApiVersion | string | Stripe API version (default: 2020-08-27)
More from this repository4
Manages and applies database schema migrations for synchronizing Stripe data into a PostgreSQL database, ensuring consistent and versioned database structure for the Stripe Sync Engine.
Backfills missing or historical Stripe data into a PostgreSQL database by retrieving and synchronizing past entities from a Stripe account.
Helps diagnose and resolve synchronization issues between Stripe data and the PostgreSQL database by providing targeted troubleshooting insights and potential resolution strategies.
Queries and retrieves synchronized Stripe data from a PostgreSQL database, enabling efficient data exploration and analysis of Stripe objects.