MATIH Platform is in active MVP development. Documentation reflects current implementation status.
8. Platform Services
Architecture

Billing Service Architecture

The Billing Service manages all financial operations for the MATIH platform. Running on port 8087, it provides usage metering, invoice generation, subscription management, Stripe payment integration, cost center allocation, quota enforcement, coupon management, and real-time cost tracking. The service processes billable events from Kafka and generates invoices on a scheduled basis using ShedLock for distributed scheduling.


Service Overview

PropertyValue
Service Namebilling-service
Port8087
TechnologySpring Boot 3.2, Java 21
DatabasePostgreSQL (JPA/Hibernate)
Payment ProviderStripe
Event BusKafka (usage events, billing events)
SchedulingShedLock (distributed job locking)
NotificationsIntegration with Notification Service

Controllers

ControllerBase PathPurpose
BillingController/api/v1/billingUsage, invoices, subscriptions, plans, Stripe
CostCenterController/api/v1/billing/cost-centersCost center management
CostDashboardController/api/v1/billing/cost-dashboardCost analytics and dashboards
QuotaController/api/v1/billing/quotasResource quota management
CouponController/api/v1/billing/couponsCoupon and discount management
RealtimeCostController/api/v1/billing/realtime-costReal-time cost metrics and alerts
CostIngestionController/api/v1/billing/cost-ingestionCloud cost data ingestion
SimplifiedPricingController/api/v1/billing/pricingSimplified pricing calculations
MilestoneController/api/v1/billing/milestonesUsage milestone tracking

Key Entities

EntityDescription
UsageRecordIndividual usage events (API calls, storage, compute)
UsageAggregateAggregated usage data for billing periods
InvoiceGenerated invoices with line items
SubscriptionTenant subscription to a plan
PlanPricing plan definitions
ResourceQuotaPer-tenant resource quotas
CostCenterCost allocation centers
RealtimeCostMetricReal-time cost tracking data

Next Steps