Skip to content
Mermaid templates

Metered usage, rating and invoice reconciliation

Keeps raw usage, versioned pricing and issued billing records separate for reproducible reconciliation. Original worked design example; adapt responsibilities, thresholds and assumptions to your system.

Template previewMermaid
Rendering…

What this template contains

Diagram type
Entity-relationship diagram
Source
54 lines

Make it your own.

erDiagram
ACCOUNT ||--o{ SUBSCRIPTION : holds
PLAN ||--o{ SUBSCRIPTION : selected
SUBSCRIPTION ||--o{ USAGE_EVENT : meters
USAGE_EVENT ||--o| RATED_ITEM : rated_as
RATE_VERSION ||--o{ RATED_ITEM : prices
INVOICE ||--o{ INVOICE_LINE : contains
RATED_ITEM ||--o| INVOICE_LINE : billed_as
ACCOUNT ||--o{ INVOICE : receives
INVOICE ||--o{ CREDIT_NOTE : adjusted_by
ACCOUNT {
 string account_id PK
}
PLAN {
 string plan_id PK
 string name
}
SUBSCRIPTION {
 string subscription_id PK
 string account_id FK
 string plan_id FK
}
USAGE_EVENT {
 string event_id PK
 string subscription_id FK
 string quantity
 string occurred_at
}
RATE_VERSION {
 string rate_version_id PK
 string effective_from
 string unit_price
}
RATED_ITEM {
 string rated_id PK
 string event_id FK
 string rate_version_id FK
 string amount
}
INVOICE {
 string invoice_id PK
 string account_id FK
 string status
}
INVOICE_LINE {
 string line_id PK
 string invoice_id FK
 string rated_id FK
}
CREDIT_NOTE {
 string credit_id PK
 string invoice_id FK
 string reason
}