PHPackages                             iprote/tcb-cms - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. iprote/tcb-cms

ActiveLibrary[Payment Processing](/categories/payments)

iprote/tcb-cms
==============

Production-ready Laravel package for TCB Bank CMS API integration — payments, IPN, reconciliation, and loan disbursement.

v1.0.1(1mo ago)02↓50%MITPHPPHP ^8.2

Since Jun 28Pushed 1mo agoCompare

[ Source](https://github.com/iprote-Technologies/tcb)[ Packagist](https://packagist.org/packages/iprote/tcb-cms)[ Docs](https://github.com/iprote-Technologies/tcb)[ RSS](/packages/iprote-tcb-cms/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (1)Dependencies (9)Versions (3)Used By (0)

iprote/tcb-cms
==============

[](#iprotetcb-cms)

Production-ready Laravel package for **TCB Bank CMS API** integration.

**Developer:** Dr Constantino Msigwa
**Company:** Iprote Technologies Limited

Supports payment collection, instant payment notifications (IPN), reconciliation, reference cancellation, loan disbursement, and extensible architecture for future TCB CMS services.

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11+, 12+, or 13+

Installation
------------

[](#installation)

```
composer require iprote/tcb-cms
```

Or, before Packagist publication, require directly from GitHub:

```
composer require iprote/tcb-cms:dev-main
```

### Publish on Packagist

[](#publish-on-packagist)

1. Create a Packagist account at [packagist.org](https://packagist.org)
2. Submit package URL: `https://github.com/iprote-Technologies/tcb`
3. Enable the GitHub webhook for automatic updates on push/tag

After publication:

```
composer require iprote/tcb-cms
```

Publish configuration and migrations:

```
php artisan vendor:publish --tag=tcb-config
php artisan vendor:publish --tag=tcb-migrations
php artisan migrate
```

Environment Configuration
-------------------------

[](#environment-configuration)

Only API credentials belong in `.env`. Bank accounts are stored in the database.

```
TCB_API_KEY=your-api-key
TCB_PARTNER_CODE=PART-ABC
TCB_CLIENT_ID=partner-xyz
TCB_CLIENT_SECRET=your-client-secret
TCB_BASE_URL=https://partners.tcbbank.co.tz
TCB_RECONCILIATION_URL=https://partners.tcbbank.co.tz:8444
TCB_WEBHOOK_SECRET=your-webhook-secret
TCB_TIMEOUT=30
TCB_VERIFY_SSL=true
TCB_LOGGING=true
TCB_QUEUE_CONNECTION=database
```

Branch &amp; Account Setup
--------------------------

[](#branch--account-setup)

```
use Iprote\TcbCms\Facades\TCB;
use Iprote\TcbCms\Enums\AccountType;

$branch = TCB::branches()->create([
    'name' => 'Branch A',
    'code' => 'BR-A',
]);

TCB::branches()->addAccount($branch, [
    'account_name' => 'Collection Account',
    'account_number' => '173200000001',
    'profile_id' => '173200000001',
    'account_type' => AccountType::Collection,
    'is_default' => true,
]);

TCB::branches()->addAccount($branch, [
    'account_name' => 'Disbursement Account',
    'account_number' => '173200000002',
    'profile_id' => '173200000002',
    'account_type' => AccountType::Disbursement,
    'is_default' => true,
]);
```

Usage
-----

[](#usage)

### Create Reference Number

[](#create-reference-number)

```
$reference = TCB::createReference('BR-A', [
    'reference' => '999ABC123456789',
    'name' => 'John Doe',
    'mobile' => '255713999934',
    'message' => 'TUITION FEE',
]);
```

### Fluent Builder

[](#fluent-builder)

```
TCB::branch('BR-A')
    ->collectionAccount()
    ->createReference([
        'reference' => '999ABC123456789',
        'name' => 'John Doe',
        'mobile' => '255713999934',
        'message' => 'COLLECTION',
    ]);

TCB::branch('BR-A')
    ->disbursementAccount()
    ->disburse([
        'amount' => 500000,
        'reference' => 'LOAN-001',
        'description' => 'Loan disbursement',
    ]);
```

### Cancel Reference

[](#cancel-reference)

```
TCB::cancelReference('BR-A', '999ABC123456789');
```

### Reconciliation

[](#reconciliation)

```
TCB::reconciliation('BR-A', '2026-01-01', '2026-01-31');
```

### Verify Payment

[](#verify-payment)

```
$transaction = TCB::verifyPayment('999ABC123456789');
```

### TCB Partners APIs (v1.2)

[](#tcb-partners-apis-v12)

```
$token = TCB::authenticate();
$fsps = TCB::botFsps();
$lookup = TCB::accountLookup([
    'accountNo' => '110210001001',
    'institutionCode' => '048',
]);
$transfer = TCB::aggregatorPayment([
    'reference' => '9099959804450',
    'msisdn' => '2556578717069',
    'amount' => '390.00',
    'description' => 'TIPS transfer payment',
]);
```

Webhook (IPN)
-------------

[](#webhook-ipn)

TCB sends payment notifications to:

```
POST /webhooks/tcb

```

Configure your callback URL with TCB Bank to point to this endpoint.

The package verifies signatures, prevents duplicates, queues processing, stores payloads, and fires events.

### Listen for Events

[](#listen-for-events)

```
use Iprote\TcbCms\Events\PaymentReceived;

Event::listen(PaymentReceived::class, function (PaymentReceived $event) {
    // Update order, loan, invoice, etc.
});
```

Available events: `ReferenceCreated`, `ReferenceCancelled`, `PaymentReceived`, `PaymentFailed`, `PaymentVerified`, `LoanDisbursed`, `DisbursementCompleted`, `DisbursementFailed`, `ReconciliationCompleted`, `WebhookReceived`, `WebhookProcessed`.

API Endpoints Implemented
-------------------------

[](#api-endpoints-implemented)

OperationTCB EndpointCreate Reference`POST /public/api/reference/{API_KEY}`Cancel Reference`POST /public/api/reference/decline/{API_KEY}`Reconciliation`POST /public/api/reconciliation/{API_KEY}`Auth (Bearer token)`POST /tcb/partners/auth/authenticate`BOT FSP list`GET /tcb/partners/tips/fsps`Account lookup`POST /tcb/partners/tips-lookup`Aggregator payment`POST /tcb/partners/aggregator/payment`Utility payment`POST /tcb/partners/utility/payment`Utility airtime`POST /tcb/partners/utility/airtime`GePG lookup`POST /tcb/partners/utility/gepgLookUp`GePG payment`POST /tcb/partners/gepg/payment`Deposit`POST /tcb/partners/deposit`Withdrawal`POST /tcb/partners/withdrawal`Transaction inquiry`GET /tcb/partners/tqs?reference=...`Architecture
------------

[](#architecture)

- **Database-driven accounts** — no hardcoded profile IDs
- **Multi-branch** — unlimited branches with multiple accounts each
- **Account auto-resolution** — collection/disbursement accounts resolved by type
- **Extensible endpoints** — new TCB APIs via `EndpointInterface`
- **Queue support** — sync, database, redis, SQS
- **Full API logging** — requests, responses, webhooks, retries

Testing
-------

[](#testing)

```
composer install
./vendor/bin/phpunit
```

License
-------

[](#license)

MIT

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance91

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

45d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/80386833?v=4)[Dr. Constantino Msigwa](/maintainers/Constantino2019-et)[@Constantino2019-et](https://github.com/Constantino2019-et)

---

Top Contributors

[![Constantino2019-et](https://avatars.githubusercontent.com/u/80386833?v=4)](https://github.com/Constantino2019-et "Constantino2019-et (3 commits)")

---

Tags

laravelcmspaymentBankingipntanzaniareconciliationTCB

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/iprote-tcb-cms/health.svg)

```
[![Health](https://phpackages.com/badges/iprote-tcb-cms/health.svg)](https://phpackages.com/packages/iprote-tcb-cms)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k16.3M152](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9922.4M146](/packages/roots-acorn)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.6k31.8M158](/packages/laravel-cashier)[laravel/scout

Laravel Scout provides a driver based solution to searching your Eloquent models.

1.7k57.2M678](/packages/laravel-scout)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
