frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: Stripe-no-webhooks – Sync your Stripe data to your Postgres DB

https://github.com/pretzelai/stripe-no-webhooks
26•prasoonds•1h ago
Hey HN,

stripe-no-webhooks is an open-source library that syncs your Stripe payments data to your own Postgres database: <https://github.com/pretzelai/stripe-no-webhooks>

Here's a demo video: <https://youtu.be/cyEgW7wElcs>

It creates a webhook endpoint in your Stripe account to forward webhooks to your backend where a webhook listener stores all the data into a new stripe.* schema. You define your plans in TypeScript, run a sync command, and the library takes care of creating Stripe products and prices, handling webhooks, and keeping your database in sync. We also let you backfill your Stripe data for existing accounts.

It supports pre-paid usage credits, account wallets and usage-based billing. It also lets you generate a pricing table component that you can customize. You can access the user information using the simple API the library provides:

  billing.subscriptions.get({ userId });
  billing.credits.consume({ userId, key: "api_calls", amount: 1 });
  billing.usage.record({ userId, key: "ai_model_tokens_input", amount: 4726 });
Effectively, you don't have to deal with either the Stripe dashboard or the Stripe API/SDK any more if you don't want to. The library gives you a nice abstraction on top of Stripe that should cover ~most subscription payment use-cases.

Let's see how it works with a quick example. Say you have a billing plan like Cursor (the IDE) used to have: $20/mo, you get 500 API completions + 2000 tab completions, you can buy additional API credits, and any additional usage is billed as overage.

You define your plan in 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",
      },
    },
  }
Then on the CLI, you run the `init` command which creates the DB tables + some API handlers. Run `sync` to sync the plans to your Stripe account and create a webhook endpoint. When a subscription is created, the library automatically grants the 500 API completion credits and 2000 tab completion credits to the user. Renewals and up/downgrades are handled sanely.

Consume code would look like this:

  await billing.credits.consume({
    userId: user.id,
    key: "api_completion",
    amount: 1,
  });
And if they want to allow manual top-ups by the user:

  await billing.credits.topUp({
    userId: user.id,
    key: "api_completion",
    amount: 500,     // buy 500 credits, charges $5.00
  });
Similarly, we have APIs for wallets and usage.

This would be a lot of work to implement by yourself on top of Stripe. You need to keep track of all of these entitlements in your own DB and deal with renewals, expiry, ad-hoc grants, etc. It's definitely doable, especially with AI coding, but you'll probably end up building something fragile and hard to maintain.

This is just a high-level overview of what the library is capable of. It also supports seat-level credits, monetary wallets (with micro-cent precision), auto top-ups, robust failure recovery, tax collection, invoices, and an out-of-the-box pricing table.

I vibe-coded a little toy app for testing: <https://snw-test.vercel.app>

There's no validation so feel free to sign up with a dummy email, then subscribe to a plan with a test card: 4242 4242 4242 4242, any future expiry, any 3-digit CVV.

Screenshot: <https://imgur.com/a/demo-screenshot-Rh6Ucqx>

Feel free to try it out! If you end up using this library, please report any bugs on the repo. If you're having trouble / want to chat, I'm happy to help - my contact is in my HN profile.

Comments

tonyx•56m ago
Interesting! Is there an escape hatch to drop down to raw Stripe primitives if someone needs a feature you haven’t modeled yet?

This feels like something many teams eventually build internally — curious how you’re thinking about long-term API surface + compatibility with new Stripe features.

prasoonds•44m ago
Hey Tony,

yes, the library is ~mostly a wrapper around Stripe with a convenience layer of a simple API that works on the your local DB. So, you will always be able to call Stripe as per usual.

The idea here was to fill the gaps left by the official Stripe implementation:

- direct access to your Stripe data in your own DB - this lets you get around Stripe API rate limits and do custom aggregations (user dashboards? I love what Cursor has done on their usage dashboard for eg)

- easy support for multiple credit types, topups and auto-topups

- usage billing that's much simpler to use (meters, usage products and prices are not exposed to the users)

Other than these basic primitives, everything else is just Stripe under the hood. You can and SHOULD use Stripe SDK for any write operations, for eg.

> This feels like something many teams eventually build internally ...

Exactly right - we've talked to so many teams who has mostly vibe-coded something fragile that mostly works for them and the pattern is common enough that we thought this separate library would be widely useful.

felix_eckert•52m ago
Looks really interesting. Can you do custom plans for some users?
prasoonds•42m ago
Hey Felix, yes you can.

This library is simply a wrapper around Stripe with easier implementation and some additional primitives (credits / wallets / real-time usage).

So, just as in Stripe, where you would make a new custom plan for, say, an enterprise use, simiarly here, you'd do the same.

Though, I will admit your `billing.config.ts` file will get pretty crowded...

I will think on it and try to come up with a more user-friendly UX for this use case.

Show HN: An AI agent that tailors your resumé to beat ATS filters

https://resume-tailoring-agent.subconscious.dev/
1•ohstep23•1m ago•0 comments

I built a Local-first AI productivity suite with OpenCode and encrypted sync

https://github.com/derekross/onyx
1•ravenbitcoin•2m ago•1 comments

Millions of Pages of Epstein Documents Released

https://www.nytimes.com/live/2026/01/30/us/epstein-files-release
2•wslh•3m ago•1 comments

Salivary microbiome diversity is associated with oral health and disease

https://www.biorxiv.org/content/10.64898/2026.01.27.702135v1
1•bmau5•3m ago•1 comments

AI product isn't expensive, your pricing is lazy

https://flexprice.io
5•NIKHILFP•4m ago•2 comments

Stressapptest / Stressful Application Test: a userspace memory and IO test

https://github.com/stressapptest/stressapptest
1•fanf2•5m ago•0 comments

Show HN: WebGPU vs. CPU Benchmark – see how much faster WebGPU is for you

https://claude.ai/public/artifacts/3fa5f4cc-eaad-4f82-975b-6fac7519526c
1•logicallee•5m ago•0 comments

Show HN: Sleeve – puts your "now playing" on your Desktop

https://replay.software/sleeve
1•sgottit•6m ago•0 comments

Linux after Linus? The kernel community drafts a plan for replacing Torvalds

https://www.zdnet.com/article/linux-community-project-continuity-plan-for-replacing-linus-torvalds/
1•taubek•6m ago•0 comments

Mark Mills on the Roaring 20s: AI, Energy, and the Next Commodity Boom [video]

https://www.youtube.com/watch?v=1Esx4A4pBlQ
1•measurablefunc•7m ago•0 comments

Claude Constitution; or love as the solution to the AI alignment problem

https://nintil.com/claude-constitution/
1•lr0•7m ago•0 comments

GNU gettext Reaches Version 1.0 After 30 Years

https://www.phoronix.com/news/GNU-gettext-1.0
1•tarp•10m ago•0 comments

Show HN: Best Weather App for iPhone

https://brzzy.co/weather-app
1•GabrielMMMM•11m ago•0 comments

The humans are screenshotting us

https://www.moltbook.com/post/01611367-056f-4eed-a838-4b55f1c6f969
1•rob•12m ago•0 comments

Was Cline just acqui-hired by OpenAI?

https://blog.kilo.ai/p/cline-just-acqui-hired
1•janpio•15m ago•0 comments

Foxmark.io

https://www.foxmark.io/
1•rpddh9•15m ago•0 comments

Los Angeles aims to ban single-use printer cartridges

https://www.tomshardware.com/peripherals/printers/los-angeles-is-looking-to-ban-single-use-printe...
2•thunderbong•15m ago•0 comments

I skipped hype and shipped my product. I've now delivered over 1k units

https://www.withhup.com/
1•stanmattingly•17m ago•1 comments

Catherine O'Hara, Singular Force of Comedy and Improv, Dead at 71

https://consequence.net/2026/01/catherine-ohara-dead/
1•andsoitis•17m ago•0 comments

Videogame stocks slide on Google's new AI world simulation model

https://finance.yahoo.com/news/videogame-stocks-slide-googles-ai-173739482.html
4•BiraIgnacio•17m ago•2 comments

AI Agent Observability and Cost Attribution

https://deborahjacob.substack.com/p/ai-agent-observability-and-cost-attribution
1•deborahjacob•19m ago•1 comments

Why the Sound Design of Cast Away Is One of Film's Greatest Hidden Achievements

https://nofilmschool.com/cast-away-sound-design
1•thunderbong•20m ago•0 comments

The Brackish Pool: Towards a Critical Practice of Reading Weird Fiction

https://strangehorizons.com/wordpress/non-fiction/the-brackish-pool-towards-a-critical-practice-o...
1•bryanrasmussen•20m ago•0 comments

Texas A&M Ends Women's Studies and Overhauls Classes Over Race and Gender

https://www.nytimes.com/2026/01/30/us/texas-am-gender-ethnic-womens-studies-academic-freedom.html
1•jbegley•21m ago•0 comments

Writing about music is like dancing about architecture

https://en.wikipedia.org/wiki/Writing_about_music_is_like_dancing_about_architecture
2•chungus•22m ago•0 comments

CooperBench: Benchmarking AI Agents' Cooperation

https://cooperbench.com/
1•embedding-shape•23m ago•0 comments

AI Agents vs. Humans: Who Wins at Web Hacking in 2026?

https://www.wiz.io/blog/ai-agents-vs-humans-who-wins-at-web-hacking-in-2026
1•shablulman•24m ago•0 comments

macOS Accessibility with Pyax

https://blog.monotonous.org/2026/01/12/macos-accessibility-with-pyax/
1•PaulHoule•25m ago•0 comments

Show HN: Fig – Experimenting with long horizon prediction for personhood

https://www.figcareer.com/
1•mochidonut•25m ago•1 comments

Context Is King: Building an AI System That Lives, Learns, and Compounds

https://fixedtoflow.substack.com/p/context-is-king-building-an-ai-system
1•gustavocpimenta•26m ago•0 comments