Back to selected work
Selected Work

Designing a Billing Microservice for an AI SaaS Platform

From zero to a production-ready billing domain: subscriptions, credits, Stripe integration, domain events, and failure-safe webhook handling.

Overview

Built the billing backbone for an AI SaaS platform, designing how usage, plans, credits, and payment events interact without tightly coupling the product to Stripe-specific workflows.

Problem

The main problem was keeping billing reliable while still supporting frequent product changes, usage-based pricing, and webhook-driven updates from external systems.

Approach

Modeled billing as its own domain, introduced domain events around payments and subscription state, and made webhook processing idempotent and failure-tolerant.

Outcomes

  • Supported subscription and credit-based monetization.
  • Separated billing concerns from product logic.
  • Reduced the blast radius of payment webhook failures.