billing-stripe
Installation
SKILL.md
Billing & Credits (Stripe)
Billing is a thick service at backend/app/services/billing/. Routes never touch Stripe directly — everything goes through BillingService (the facade in facade.py, re-exported from __init__.py).
Layout
| File | Responsibility |
|---|---|
facade.py |
BillingService — the only thing routes/workers import |
checkout_service.py |
Checkout sessions (seat-configurable) |
subscription_service.py |
Subscription CRUD, change plan, cancel/reactivate |
credit_service.py |
Credit ledger + usage aggregation |
stripe_client.py |
Thin Stripe API wrapper |
webhook_handler.py + handlers/ |
Event processing (customer / invoice / payment / subscription) |
pricing.py |
Static plan/price data |
exceptions.py |
Billing domain errors (extend core/exceptions) |
Data model: plan / price mirror Stripe products; subscription is one-per-org; stripe_event is an idempotency log; credit_transaction is an immutable ledger; usage_event records per-message token spend, rolled up into the mv_usage_daily materialized view.