Show HN: Stripe-no-webhooks – Sync your Stripe data to your Postgres DB
Source: Hacker News
Overview
stripe-no-webhooks is an open‑source library that syncs your Stripe payments data to your own Postgres database.
- Repository:
- Demo video:
Why it’s useful
- No webhook plumbing – The library creates the necessary webhook endpoint in Stripe and stores all events in a
stripe.*schema, so you don’t have to decide which webhooks to listen for or write listeners yourself. - Avoid rate limits – Stripe’s API is limited to 100 requests per minute. By querying your local Postgres you bypass this limitation, which is handy for internal tools or frequent subscription checks.
- Secure AI access – You can grant an AI agent read‑only access to the
stripe.*schema to debug payment issues (failed charges, refunds, etc.) without exposing the Stripe dashboard. - Custom analytics – Join Stripe data with your own tables for things like LTV calculations, custom reports, and more.
How it works
- The library registers a webhook endpoint in your Stripe account.
- Incoming Stripe events are forwarded to your backend, where a listener writes the data into a new
stripe.*schema in Postgres. - You define your plans in TypeScript and run a sync command. The library then creates the corresponding Stripe products and prices, handles webhooks, and keeps the database in sync.
- Existing Stripe data can be backfilled for already‑existing accounts.
Features
- Pre‑paid usage credits, account wallets, and usage‑based billing
- Auto‑generated, customizable pricing‑table component
- Simple API for accessing billing information
// Example API calls
billing.subscriptions.get({ userId });
billing.credits.consume({ userId, key: "api_calls", amount: 1 });
billing.usage.record({ userId, key: "ai_model_tokens_input", amount: 4726 });
Plan definition (TypeScript)
{
name: "Pro",
description: "Cursor Pro plan",
price: [{ amount: 2000, currency: "usd", interval: "month" }],
features: {
api_completion: {
pricePerCredit: 1, // 1 cent per unit
trackUsage: true, // Enable usage billing
credits: { allocation: 500 },
displayName: "API Completions",
},
tab_completion: {
credits: { allocation: 2000 },
displayName: "Tab Completions",
},
},
}
Consuming credits
await billing.credits.consume({
userId: user.id,
key: "api_completion",
amount: 1,
});
await billing.credits.topUp({
userId: user.id,
key: "api_completion",
amount: 500, // buy 500 credits, charges $5.00
});
Additional capabilities
- Seat‑level credits and monetary wallets (micro‑cent precision)
- Auto top‑ups, robust failure recovery, tax collection, invoices
- Out‑of‑the‑box pricing table UI
Demo app
A toy app is available for testing:
- App: (no validation; feel free to sign up with a dummy email)
- Test card:
4242 4242 4242 4242, any future expiry, any 3‑digit CVV - Screenshot:
Feel free to try it out! If you use the library, please report any bugs on the repository. For help or discussion, you can reach out via your HN profile.