Walt

Billing Pipeline — Stripe → Queue → ClickHouse

Meter events → queue → holon worker → Stripe + ClickHouse + tax.

Billing Pipeline — Stripe → Queue → ClickHouse (v2026-08-28T093439Z-747172b178) 2026-09-05 | Meter events → queue → holon worker → Stripe + ClickHouse + tax. 1 - REST API - Handles billing requests billing/webhook_handler.py POST /api/billing/webhook GET /api/billing/status/{customer_id} POST /api/billing/refund 2 - Queue - Manages async operations billing_queue.py enqueue get_status list_operations depth billing_queue billing_queue.py get_status depth operation_id 3 - Holon Worker - Processes billing tasks billing_holon_worker.py process_holon create_invoice 1. Receive REST request 2. Enqueue operation 3. Process holon 4. Create invoice 5. Apply tax 6. Finalize invoice Sample holon body --- type: work-brief from: orion-claude to: billing-worker ticket: BILL-2026-05-001 priority: high required_skills: - billing - stripe-api model_tier: standard --- ## Customer ID: acme-corp (acct_6f39a711581e) ## Period May 2026 (2026-05-01 to 2026-05-31) ## Usage - API calls: 5.2M tokens @ $0.02/1M = $104.00 - Storage: 250 GB @ $0.50/100GB = $1.25 - Support: Premium tier = $500.00 **Subtotal:** $605.25 **State:** CA (6%) **Tax:** $36.31 **Total:** $641.56 Please create invoice for this customer. Sample ClickHouse event job_id: 123e4567-e89b-12d3-a456-426614174000 client_id: acme-corp product: billing task_type: invoice_creation provider: stripe model: standard input_tokens: 1000 output_tokens: 2000 cost_usd: 10.00 ts_completed: 2023-10-01T12:00:00Z hmac_receipt: abcdef123456 change_id: ch_1234567890 spec_level: 1 The billing service publishes events to mx.billing.* topics, but these are not shown in the diagram for brevity. Legend actor = initiates work · process = code path · store = state on disk · bus = durable queue · dashed = separate process cyan = request flow · pink = state read/write · dashed green = pull / return path · red = refusal As of 2026-09-05 12:16 UTC, from commit 18366b7

Provenance

This drawing is generated, not drawn. It is rebuilt from the source files below, so when they change the picture changes — a diagram here cannot quietly describe a system that no longer works this way.

Owner
Walt
Slug
billing-pipeline
Rendered
2026-08-28T093439Z
From commit
747172b178
Updated
5 Sep 2026, 12:16 UTC
Sources at
18366b7
Watches
5 paths
  • daemon/src/billing_queue.py
  • daemon/src/billing_service.py
  • daemon/src/billing_holon_worker.py
  • daemon/src/billing_tax.py
  • daemon/src/clickhouse_billing.py