Skip to content

Command menu

Jump to a section, open a case study, or copy my email

All work
Case study · graph8 · 2025

Credits and Stripe billing

One credit server that meters every paid action across the product, with Stripe for subscriptions and top-ups and a ledger behind usage analytics.

RoleCreated the credit server and wrote about half of its code
Stack
PythonFastAPIPostgreSQLStripe

Problem

Calls, emails, enrichment and AI replies all cost money, so every one of them needed a price, a balance to draw from, and a record customers could trust.

How it works

  1. actionPaid action starts
  2. holdHold credits
  3. settleCharge or release
  4. ledgerLedger and usage

Decisions and tradeoffs

Hold, then chargeLong actions like calls reserve credits up front and settle on the real usage, so a balance can't go negative mid-call.Cost: Holds need expiry and reconciling.
Stripe moves money, the ledger keeps the truthSubscriptions and top-ups run through Stripe Checkout and webhooks; every credit movement is recorded in our own ledger.Cost: Two systems to keep in sync.
One credit server for every productVoice, chat, the dialer and enrichment all charge through the same service instead of each billing on its own.Cost: One service every product depends on.
Next case studyAI Inbox