Invoices & Billing Statements Module Documentation
π― User Roles & Key Capabilities
Section titled βπ― User Roles & Key Capabilitiesβ| Role | Primary Use Case | Key Capabilities |
|---|---|---|
| Customer Account Administrator | Corporate telecom self-service management. | View account balance, purchase additional DIDs, manage subscribed plans, and configure company profile. |
| Finance / Accounts Payable | Wallet replenishment & invoice payments. | Add funds via credit card / bank transfer, download official PDF invoices, and monitor transaction ledgers. |
| End Subscriber | Personal usage tracking. | Review outbound call history, check message logs, and inspect plan quota consumption. |
Module Code:
billing/client/invoices
Route:/portal/invoices
Backend Service:clientService.ts(ring2all-billing-api)
Database Tables:invoices,invoice_items,payment_methods
Brand Purity: 100% White-Label Compliant (Ring2All BSS)
Table of Contents
Section titled βTable of Contentsβ- Executive Summary & Settlement Transparency
- Technical Architecture & Invoicing Lifecycle
- Visual Interface & Screen Breakdown
- Automated Dunning Prevention & One-Click Payment
- PDF Tax Invoice Generation & Breakdown
- Diagnostic CLI & Operational Playbooks
- Domain Glossary
1. Executive Summary & Settlement Transparency
Section titled β1. Executive Summary & Settlement TransparencyβThe Invoices & Billing Statements module provides enterprise subscribers with a self-service financial ledger for reviewing generated statements, downloading official PDF tax invoices, and settling unpaid balances via tokenized payment methods.
+-------------------------------------------------------------------------------+| COMMERCIAL & OPERATIONAL IMPACT |+-------------------------------------------------------------------------------+| β’ Accelerated Collections: Clients can settle past-due invoices with one || click using stored payment credentials, drastically lowering DSO. || β’ Full Itemization: Detailed breakdown of recurring subscription plans, || minute package overages, DID monthly concessions, and toll usage. || β’ Automated Service Restoration: Settle outstanding balances to immediately || restore suspended SIP trunks and PBX extensions. || β’ Compliance & Record Keeping: Permanent access to tax-compliant statements. |+-------------------------------------------------------------------------------+2. Technical Architecture & Invoicing Lifecycle
Section titled β2. Technical Architecture & Invoicing LifecycleβInvoices are generated either via recurring subscription sweeps or automated out-of-bundle usage threshold billing. When a customer initiates payment, the API executes payment verification via Stripe:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β Customer Reviews Invoice Table β β Route: /portal/invoices β βββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ β Click "Pay Now" βΌ ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β Ring2All BSS API (POST /api/client/invoices/:id/pay) β β β’ Verifies Default Vaulted Payment Method β β β’ Dispatches Stripe PaymentIntent Confirmation β βββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ β βββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββ β Success β Error βΌ βΌ βββββββββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββββββββ β PostgreSQL 17 Atomic Updates β β Dunning Lifecycle Handler β β β’ invoices.status = 'paid' β β β’ Records Last Failure Error β β β’ invoices.paid_at = NOW() β β β’ Sets Next Retry Interval β β β’ Unfreezes Customer SIP Trunks β β β’ Dispatches Alert Email β βββββββββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββββββββ3. Visual Interface & Screen Breakdown
Section titled β3. Visual Interface & Screen Breakdownβ4.1 Invoices & Billing Statements Overview
Section titled β4.1 Invoices & Billing Statements OverviewβThe interface categorizes invoices chronologically with dynamic payment status badges:

- Invoice Number & Dates: Unique alphanumeric statement ID alongside statement generation and due dates.
- Billing Period: Clear start and end dates covering recurring fees and metered usage.
- Total & Balance: Total invoiced amount and remaining unpaid balance in USD.
- Status Badges: Visual indicators for
Paid(emerald),Unpaid / Open(amber), andOverdue(destructive red). - Payment Action: Instant βPay Nowβ action button for open invoices.
4. Automated Dunning Prevention & One-Click Payment
Section titled β4. Automated Dunning Prevention & One-Click PaymentβTo prevent service degradation:
- One-Click Vaulted Settlement: If the customer has a default card saved in Payment Methods, clicking Pay Now completes payment in less than 2 seconds without re-entering card numbers.
- Idempotency Safeguards: Stripe PaymentIntents are tagged with unique invoice UUIDs to eliminate double-billing risks during network retries.
- Instant Service Unfreeze: When an invoice in dunning status is paid, the system updates
customers.status = 'active'and Ring2All SBC Engine unblocks outbound call routing within 100 milliseconds.
5. PDF Tax Invoice Generation & Breakdown
Section titled β5. PDF Tax Invoice Generation & BreakdownβOfficial PDF invoices include:
- Corporate Entity Details: Service provider brand, tax ID, registration address, and banking coordinates.
- Customer Entity Details: Billed company name, tax ID, physical address, and account number.
- Itemized Charges Table: Plan tier recurring base fee, active DIDs, and out-of-bundle call minutes.
- Payment Receipts: Transaction reference number, authorization code, and payment gateway timestamp.
6. Diagnostic CLI & Operational Playbooks
Section titled β6. Diagnostic CLI & Operational PlaybooksβVerify Invoice Record via Database
Section titled βVerify Invoice Record via Databaseβsu - postgres -c "psql -d ss_billing -c \"SELECT invoice_number, status, total_amount, amount_paid, due_date, paid_atFROM invoicesWHERE customer_id = 5;\""7. Domain Glossary
Section titled β7. Domain Glossaryβ- DSO (Days Sales Outstanding): Average number of days taken to collect payment after statement issuance.
- Dunning: Process of communicating with customers to collect past-due balances before suspension.
- PaymentIntent: Stripe cryptographic object representing a customerβs payment lifecycle.

