mirzoev.cv — home
Telecom · Backend

Billing API Service

A single service that charges subscriber balances for paid services. The core knows nothing about individual operators — each operator’s protocol is isolated in its own adapter.

Category
Telecom · Backend
Role
Architecture and backend development
Stack
Go · gRPC · Telegram Bot API

The problem

  • Paid short-code services need to charge the balances of subscribers across different mobile operators.
  • Every operator has its own charging protocol: some charge in a single request, others require two steps (reserve, then confirm).
  • Operator channels must never be mixed: an operator A subscriber is charged only through operator A’s channel.
  • The team needs complete per-request data for later analysis, plus timely alerts about important events.

The solution

  • A Go core with one charging interface and a set of adapters — one per operator (Adapter pattern).
  • Each adapter encapsulates its operator’s protocol: single-step charge or two-step confirmation.
  • Strict routing: a request goes only to the adapter of the subscriber’s operator.
  • Configuration for multiple accounts per operator.
  • An Admin API for management and per-request metrics export.
  • Telegram notifications for the team.
  • Adding an operator means adding an adapter — the core stays unchanged.

Architecture

Charge request path
Charge request pathA client service calls the Billing API over gRPC with a charge request. The core resolves the subscriber’s operator and selects that operator’s adapter only. The adapter runs the operator protocol: a single charge, or reserve-and-confirm. The Admin API provides management and per-request metrics; key events are sent to Telegram.Client servicepaid serviceBilling APIgRPCCharging coreroutingOperator A adaptersingle-step chargeOperator B adapterreserve → confirmOperator A billingOperator B billingAdmin APImanagement & metricsTelegramalerts
Data flow, step by step
  1. A client service calls the Billing API over gRPC with a charge request.
  2. The core resolves the subscriber’s operator and selects that operator’s adapter only.
  3. The adapter runs the operator protocol: a single charge, or reserve-and-confirm.
  4. The Admin API provides management and per-request metrics; key events are sent to Telegram.
  • Adapters isolate protocol differences, keeping the core small and testable.
  • Separate operator channels rule out charging through the wrong billing system.
  • Per-request metrics are collected from day one as the basis for analysis and monitoring.

My contribution

  • Architecture design: core and operator adapters
  • Backend development in Go
  • Admin API and metrics requirements

Technology stack

  • Goservice core and operator adapters
  • gRPCinterface for internal services
  • Telegram Bot APIteam notifications
← All projects

Need a similar system?
Let’s discuss your project.