196 Stripe Events Cloud Function Pub/Sub billing-webhooks subs-api PGQ / Kafka
196 Events Stripe webhooks Cloud Function filter + route Pub/Sub message queue 27 Handlers billing-webhooks 11 Endpoints subs-api ~50 Services PGQ / Kafka
Event compression — 196 Stripe event types narrow through each stage before reaching downstream services.
recompute provision mandate sync invoice events downstream subs-api central orchestrator Dunning debt recovery Entitlements access control Mandate Mgmt payment mandates Invoice Processing finalize + charge Event Fan-Out PGQ → Kafka
subs-api distributes processed events to five billing subsystems.
Dunning
debt recovery · critical path

Recompute engine evaluates all 5 stores, determines correct dunning state, applies minimal diff. The critical path — failure here leaves accounts in undefined state.

Entitlements
access control · ~50 consumers

Grants and revokes feature access based on subscription state changes. ~50 product services read entitlements at runtime.

Mandate Management
payment mandates

Manages payment mandates — the authorization agreements between customers and payment providers for recurring charges.

Invoice Processing
finalize + charge

Invoice finalization and charge attempts. Processes invoice.paid, invoice.payment_failed, and related Stripe events.

Event Fan-Out
PGQ → Kafka → ~50 services

Downstream distribution. Every processed event publishes to PGQ, which bridges to Kafka for the ~50 consuming services.

TableOwnerWhat It StoresAccess Pattern
subs_dunningArea 3Dunning state per account — retry count, escalation levelA3 recompute reads + writes
subs_accountSharedAccount flags, billing profile, bad_debt statusA1 writes profiles, A3 writes bad_debt
subs_customerSharedStripe ↔ CF customer mappingA1 setup, A2 checkout
subs_mandateArea 3Payment mandates — authorization agreementsA3 reads + writes
subs_stuck_eventsArea 3Unprocessed webhook events — the orphan storeA3 writes, ops reads
StripeExternalPayment status, mandates, invoice statewebhooks → all areas