Test clock scenarios for Stripe billing logic
The idea
Billing code has the worst testing story in SaaS. Proration maths, trial-to-paid conversion, dunning recovery and mid-cycle plan changes only manifest across weeks of simulated time, so most teams ship billing logic on faith and find the bugs in production, where every bug is a refund, a double charge or a silent churn event. Stripe built test clocks precisely for this, then left them as raw API primitives that almost nobody scripts by hand.
The wedge is productising what Stripe left on the table: a library of prebuilt scenarios plus assertions on the thing that actually matters, the webhooks your endpoint received. Nobody cares that Stripe’s internal state is correct; they care that their own handler processed the right events in the right order.
Who pays
The buyer is a SaaS developer or small platform team that owns billing code, paying 29 to 79 dollars a month, card checkout, no sales. Distribution runs through Stripe-adjacent channels: the Stripe developer Discord, dev.to and Hacker News posts on billing horror stories, and SEO on long-tail queries like testing Stripe proration. Money bugs make this an easy expense to justify.
MVP scope
- Stripe test-mode connection with encrypted restricted keys
- Six prebuilt scenarios covering trials, dunning, upgrades and downgrades
- Test-clock runner that advances time and polls clock readiness between steps
- Webhook capture per run with assertion evaluation and a pass/fail report
- API token so runs can gate CI
- Skip for v1: custom scenario builder UI, Paddle or Chargebee support, live-mode anything, multi-currency matrices
Build ClockWork, a web app that runs scripted Stripe test-clock scenarios against a user's Stripe test account and asserts on the webhooks their endpoint received. Stack: Next.js (App Router), Stripe API, Postgres via Prisma. Core flow: user connects their Stripe test-mode key (restricted key, stored encrypted), registers their webhook endpoint URL, and picks a scenario from a library. Each scenario is a declarative script of steps: create customer on a test clock, subscribe to plan X, advance clock 14 days, attach a failing card, advance to renewal, swap plan mid-cycle. The runner executes steps via the Stripe API, advancing the test clock and polling until Stripe finishes simulating between steps (test clocks advance asynchronously; poll clock status until ready before the next step, this is the detail everyone gets wrong). Webhook capture: give each run a unique forwarding URL; the user adds it as a test-mode webhook endpoint once. Store every event received during the run, then evaluate assertions like "exactly one invoice.paid, no invoice.payment_failed, subscription ends in status active on plan Y". Prebuilt scenarios for v1: trial converts, trial cancels, card fails then recovers via dunning, mid-cycle upgrade with proration, downgrade at period end, annual renewal. Pages: landing, scenario library, run detail with a step timeline and event log diffed against assertions, settings. Runs also triggerable from CI via API token. Pricing: free for 10 runs a month, 49 dollars a month unlimited with CI integration.
// More Dev tool ideas
-
Deprecation countdowns for the APIs you use
Stripe and Shopify deprecations hide in changelogs until things break; this scans your code for affected calls and gives you a countdown.
Dev tool 1 month -
App store reviews filed as GitHub issues
Bug reports buried in app store reviews never reach the tracker; this clusters new reviews and files deduped GitHub issues nightly.
Dev tool 1 week -
Nightly restore drills for database backups
A backup you've never restored is a guess; this restores your Postgres dump to a scratch instance nightly and proves the data is intact.
Dev tool 1 week -
Hosted monitoring and alerts for BullMQ queues
A stuck BullMQ queue can silently eat jobs for days; hosted dashboards, dead-letter alerts and retry controls without running Grafana.
Dev tool 1 week