Subscription Billing Cycle
System ↔ SystemUsage metering, invoice generation, payment processing, and revenue recognition.
6 nodes · 6 edgessaas
eventsystemapidb
Visual
Billing Cycle Triggerevent
Cron job fires on subscription renewal date.
↓sequential→ Usage Metering
Usage Meteringdb
Query usage events table for API calls, storage, seats in billing period.
↓sequential→ Invoice Generation
Invoice Generationsystem
Calculate line items, apply discounts, prorate mid-cycle changes.
↓sequential→ Payment Processing
Payment Processingapi
Charge via Stripe/Braintree, handle card decline retry logic.
↓conditional→ Receipt Delivery
↓fallback→ Payment Processing
Receipt Deliveryapi
Email PDF invoice and receipt to billing contact.
↓sequential→ Revenue Recognition
Revenue Recognitiondb
Post ASC 606 compliant journal entries to accounting system.
uc-subscription-billing.osop.yaml
osop_version: "1.0"
id: "subscription-billing"
name: "Subscription Billing Cycle"
description: "Usage metering, invoice generation, payment processing, and revenue recognition."
nodes:
- id: "billing_trigger"
type: "event"
name: "Billing Cycle Trigger"
description: "Cron job fires on subscription renewal date."
- id: "usage_meter"
type: "db"
name: "Usage Metering"
description: "Query usage events table for API calls, storage, seats in billing period."
timeout_sec: 60
- id: "invoice_gen"
type: "system"
name: "Invoice Generation"
description: "Calculate line items, apply discounts, prorate mid-cycle changes."
- id: "payment_process"
type: "api"
subtype: "rest"
name: "Payment Processing"
description: "Charge via Stripe/Braintree, handle card decline retry logic."
retry_policy:
max_attempts: 3
backoff: "exponential"
security:
risk_level: "high"
- id: "receipt_delivery"
type: "api"
name: "Receipt Delivery"
description: "Email PDF invoice and receipt to billing contact."
- id: "rev_recognition"
type: "db"
name: "Revenue Recognition"
description: "Post ASC 606 compliant journal entries to accounting system."
edges:
- from: "billing_trigger"
to: "usage_meter"
mode: "sequential"
- from: "usage_meter"
to: "invoice_gen"
mode: "sequential"
- from: "invoice_gen"
to: "payment_process"
mode: "sequential"
- from: "payment_process"
to: "receipt_delivery"
mode: "conditional"
when: "payment.status == 'succeeded'"
- from: "receipt_delivery"
to: "rev_recognition"
mode: "sequential"
- from: "payment_process"
to: "payment_process"
mode: "fallback"
label: "Retry with updated payment method"