Elicon
← ALL REFERENCE ENGAGEMENTS
REFERENCE ENGAGEMENT
SaaS

Billing Engine Replacement for a SaaS Company

Replace homegrown billing with one source of truth, without a day of billing downtime.

  • Next.js
  • Postgres
  • Stripe
  • Redis

Reference engagements illustrate how Elicon would approach a project of this kind — the problem, the architecture and the decisions. They are examples, not accounts of past client work.

THE SITUATION

The problem.

A SaaS company whose homegrown billing quietly leaks money through missed dunning, manual invoices and inconsistent proration. The engagement moves billing onto Stripe as the single authority, pipes real usage metering into it, adds customer self-service, and proves correctness against the old system before cutover.

Homegrown billing breaks in subtle, expensive ways and customers can't help themselves.

  • ·Proration is implemented in more than one place, and the implementations disagree.
  • ·Billing questions arrive as support tickets because customers have no self-service.

APPROACH

How we'd run it.

  1. 01Make Stripe the pricing, proration and invoicing authority.
  2. 02Aggregate usage from the existing event stream into billable units, with reconciliation.
  3. 03Give customers self-service for cards, invoices, plans and seats.
  4. 04Shadow-compare new invoices against the old system before switching.

ARCHITECTURE

What gets built.

Usage metering

Events aggregated into billable units, deduplicated by idempotency key and pushed on a schedule with a reconciliation pass. Late events land in the correct period instead of disappearing.

Webhook processing

Signed webhooks into a queue with idempotent processors and a dead-letter path. State changes are derived from the provider's events, never assumed after an API call.

Migration harness

A dual-write, shadow-compare period: the new engine computes invoices alongside the old one, differences are reported daily, and cutover waits until the diff stays empty.

DECISIONS

The trade-offs.

Stripe as the source of truth, not a payment processor behind custom logic

Homegrown billing converges on reimplementing proration, tax and dunning badly. Deleting that surface is the strategic move.

TRADE-OFFPricing experiments live within the provider's model, and lock-in is real.

Shadow-compare before cutover

The only trustworthy proof that new billing is correct is agreement with old billing on real accounts across a full cycle.

TRADE-OFFExtra time and dual-write plumbing that is thrown away afterwards.

Preserve grandfathered plans exactly

Quietly re-pricing legacy accounts during a technical migration turns a billing project into a churn event.

TRADE-OFFMore plan objects to carry, some never sold again.

STACK

Typical stack.

APPLICATION
Next.jsTypeScriptPostgresRedis
BILLING
Stripe BillingUsage meteringIdempotent webhooksDunning schedules
MIGRATION
Dual-write harnessShadow compareDaily diff reporting
OPS
Queue with dead-letterReconciliation jobsRevenue dashboards

Work of this shape usually runs as Demo to Production →

SIMILAR PROBLEM?

Tell us what you're dealing with.

One conversation with an engineer is usually enough to tell whether this is a few weeks of work, a few months, or something you shouldn't build at all.

Talk to an engineer →