From payment to connected.

An automated subscriber gateway connecting M-Pesa billing, MikroTik access policies, and real-time PPPoE and Hotspot session tracking.

ISP Billing Gateway

MikroTik APIM-Pesa DarajaPPPoEHotspot

Conceptual interface illustration · Architecture overview based on the project brief

The challenge

A real operational problem.

Subscriber payments and network access must stay in sync, even when callbacks are delayed or a gateway is temporarily unavailable.

The approach

Designed around the system.

Treat payment confirmation and provisioning as separate, traceable steps. Reconcile billing events before applying access and bandwidth policies through the MikroTik API.

Inside the system

Explore the architecture.

Select a component to see its role.

Subscriber portal

Lets subscribers initiate payments and gives operators visibility into plans and sessions.

Core capabilities

  • M-Pesa STK push billing
  • Automated subscriber provisioning
  • Dynamic bandwidth policies
  • Real-time session tracking
Architecture considerations

The decisions that deserve attention.

The following explains design considerations for this system. It is not a claim that each control has been independently verified in production.

Payment confirmation and network activation are different facts

An accepted payment can coexist with a failed router connection. A recoverable provisioning workflow preserves the payment while making the access state clear.

Retries must converge on the intended entitlement

Duplicate callbacks and repeated jobs should not create extra access. Stable transaction identifiers and recorded provisioning intent make reconciliation possible.

Management access is a separate trust boundary

Router control, subscriber administration, and public billing initiation need different access levels. Credentials belong behind a controlled server interface.

What to validate

  • Verify duplicate callbacks cannot duplicate subscriber entitlement.
  • Test provider rejection, delayed confirmation, and unavailable network gateways.
  • Reconcile intended and actual access after a timeout before repeating changes.
Explore the next systemEcoRoute

Trace the boundary between money and network access.

The gateway brief connects M-Pesa STK push billing, subscriber management, MikroTik policy changes, and live session visibility. This explanation follows the state transitions that need to remain understandable when the systems respond at different times.

Record the intended renewal before relying on a callback

A subscriber selects a plan and initiates payment. The application should be able to correlate later provider events with the expected account, amount, plan, and request identity. That correlation is the context needed to decide what the payment authorizes.

The initial response may indicate that a payment request was accepted for processing rather than that payment is final. The subscriber experience should present that distinction clearly and provide a way to understand a pending or unsuccessful attempt without prematurely promising active access.

Make repeated delivery safe to process

Payment callbacks and application retries can repeat. A stable provider transaction identity and a database uniqueness rule can help prevent the same verified payment from being recorded as separate new entitlements. The complete design must also define how conflicting or incomplete events are reconciled.

Where the workflow uses a provisioning job, recording the confirmed payment and the intended job in one durable transaction can reduce the gap between those facts. The job processor should converge on the intended subscriber state rather than create another entitlement every time it runs.

Treat the gateway as an external stateful system

A MikroTik management request crosses a network boundary and changes state outside the billing database. If the request times out, the caller may not know whether the device applied the policy. A retry strategy should account for that uncertainty.

Read and compare actual state when appropriate, record attempts, and surface an exception that cannot be resolved within the agreed retry policy. An operator should be able to identify the payment, the intended plan, the last observed device state, and the next safe recovery action.

Distinguish policy from an observed session

An access policy describes what a subscriber is permitted to receive. A session record describes a particular observed connection. These facts are related, but one does not always imply that the other exists at that instant. The interface should avoid collapsing them into an ambiguous “active” label.

Define the relevant states with the network team. Depending on the integration, operators may need separate views for paid entitlement, policy applied, session observed, expired plan, and unresolved provisioning. Clear terminology makes troubleshooting more efficient and reduces unsupported assumptions.

Prepare a reconciliation and support workflow

The recovery path should explain what a support operator may inspect or change, which actions require additional authorization, and how the reason for a manual intervention is recorded. This becomes especially important when a payment is confirmed but an access change remains unresolved.

A production review would examine transaction correlation, callback verification, idempotency, router access controls, diagnostic events, and operator runbooks. The portfolio brief does not establish carrier availability or independently audited payment controls, so those requirements must be scoped and verified for an actual deployment.

Subscriber states that should remain separate

StateEvidenceNext question
Payment pendingAn expected request exists, but final status is not confirmed.Has the provider supplied a verifiable final outcome?
Payment confirmedThe transaction matches the expected renewal context.Has the corresponding entitlement been recorded?
Provisioning pendingA durable access intent awaits device confirmation.Should the system inspect, retry, or escalate?
Access policy appliedThe relevant network configuration was observed or confirmed.Is the subscriber connected, and what session evidence exists?
A good system starts with a conversation

What are you
building next?

Bring us your hardest software or infrastructure challenge.
Let’s find a clear path forward.

Let’s talk about your project