PHPackages                             malipopay/malipopay-php - 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. malipopay/malipopay-php

ActiveLibrary[Payment Processing](/categories/payments)

malipopay/malipopay-php
=======================

Official PHP SDK for the Malipopay payment platform (Tanzania)

v1.1.0(1mo ago)09↓50%1MITPHPPHP &gt;=8.0CI failing

Since Apr 12Pushed 1mo agoCompare

[ Source](https://github.com/Malipopay/malipopay-php)[ Packagist](https://packagist.org/packages/malipopay/malipopay-php)[ Docs](https://malipopay.co.tz)[ RSS](/packages/malipopay-malipopay-php/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (1)Versions (3)Used By (1)

Malipopay PHP SDK
=================

[](#malipopay-php-sdk)

The official PHP SDK for the [Malipopay](https://malipopay.co.tz) payment platform (Tanzania).

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

[](#requirements)

- PHP 8.0 or later
- cURL extension
- JSON extension

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

[](#installation)

```
composer require malipopay/malipopay-php
```

Quick Start
-----------

[](#quick-start)

```
use Malipopay\Malipopay;

$client = new Malipopay('your_api_key');

// Collect mobile money
$payment = $client->payments->collect([
    'amount' => 50000,
    'currency' => 'TZS',
    'phoneNumber' => '255712345678',
    'reference' => 'ORDER-001',
    'callbackUrl' => 'https://yourapp.com/webhooks/malipopay',
]);
```

Configuration
-------------

[](#configuration)

```
$client = new Malipopay('your_api_key', [
    'environment' => 'uat',          // 'production' (default) or 'uat'
    'base_url' => 'https://...',     // Override base URL
    'timeout' => 60,                 // Request timeout in seconds (default: 30)
    'retries' => 3,                  // Retry attempts on 429/5xx (default: 2)
    'webhook_secret' => 'whsec_...', // Webhook verification secret
]);
```

### Environments

[](#environments)

EnvironmentBase URLProduction`https://core-prod.malipopay.co.tz`UAT`https://core-uat.malipopay.co.tz`Resources
---------

[](#resources)

### Payments

[](#payments)

```
// Initiate a payment
$client->payments->initiate([...]);

// Collect (mobile money pull)
$client->payments->collect([
    'amount' => 50000,
    'currency' => 'TZS',
    'phoneNumber' => '255712345678',
    'reference' => 'ORDER-001',
    'callbackUrl' => 'https://yourapp.com/callback',
]);

// Disburse funds
$client->payments->disburse([
    'amount' => 25000,
    'currency' => 'TZS',
    'phoneNumber' => '255712345678',
    'reference' => 'DISB-001',
]);

// Pay now (instant)
$client->payments->payNow([...]);

// Verify a payment
$client->payments->verify('PAY-REF-001');

// Get payment by reference
$client->payments->get('PAY-REF-001');

// List / search payments
$client->payments->list(['page' => 1, 'limit' => 20]);
$client->payments->search(['status' => 'completed']);

// Approve and confirm approval
$client->payments->approve(['reference' => 'PAY-REF-001', 'otp' => '123456']);
$client->payments->confirmApproval([...]);

// Retry a failed payment
$client->payments->retry('PAY-REF-001');

// Create payment link
$client->payments->createLink([
    'amount' => 100000,
    'currency' => 'TZS',
    'description' => 'Product purchase',
]);
```

### Customers

[](#customers)

```
$client->customers->create([
    'name' => 'John Doe',
    'phoneNumber' => '255712345678',
    'email' => 'john@example.com',
]);

$client->customers->list();
$client->customers->get('customer_id');
$client->customers->getByNumber('CUST-001');
$client->customers->getByPhone('255712345678');
$client->customers->search(['name' => 'John']);
$client->customers->verify('255712345678');
```

### Invoices

[](#invoices)

```
// Get next invoice number
$nextNo = $client->invoices->nextInvoiceNo();

// Create an invoice
$client->invoices->create([
    'invoiceNo' => $nextNo,
    'customerName' => 'Acme Corp',
    'dueDate' => '2026-05-01',
    'currency' => 'TZS',
    'items' => [
        ['description' => 'Service', 'quantity' => 1, 'unitPrice' => 500000],
    ],
]);

$client->invoices->list();
$client->invoices->get('invoice_id');
$client->invoices->getByNumber('INV-001');
$client->invoices->update('invoice_id', ['dueDate' => '2026-06-01']);
$client->invoices->recordPayment([
    'invoiceId' => 'invoice_id',
    'amount' => 500000,
    'paymentMethod' => 'mobile_money',
]);
$client->invoices->approveDraft(['invoiceId' => 'invoice_id']);
```

### Products

[](#products)

```
$client->products->create([
    'name' => 'Premium Plan',
    'price' => 100000,
    'currency' => 'TZS',
]);

$client->products->list();
$client->products->get('product_id');
$client->products->getByNumber('PROD-001');
$client->products->update([...]);
```

### Transactions

[](#transactions)

```
$client->transactions->list();
$client->transactions->get('txn_id');
$client->transactions->search(['type' => 'credit', 'from' => '2026-01-01']);
$client->transactions->paginate(['page' => 1, 'limit' => 50]);
$client->transactions->tariffs();
```

### Account

[](#account)

```
$client->account->transactions();
$client->account->searchTransactions(['from' => '2026-01-01']);
$client->account->getTransaction('txn_id');
$client->account->reconciliation();
$client->account->financialPosition();
$client->account->incomeStatement();
$client->account->generalLedger();
$client->account->trialBalance();
```

### SMS

[](#sms)

```
$client->sms->send([
    'to' => '255712345678',
    'message' => 'Your payment of TZS 50,000 was received.',
]);

$client->sms->sendBulk([
    'recipients' => ['255712345678', '255713456789'],
    'message' => 'Bulk message',
]);

$client->sms->schedule([
    'to' => '255712345678',
    'message' => 'Scheduled message',
    'sendAt' => '2026-04-15T09:00:00Z',
]);

$client->sms->list();
$client->sms->get('sms_id');
$client->sms->search(['status' => 'delivered']);
```

### References

[](#references)

```
$client->references->banks();
$client->references->institutions();
$client->references->currencies();
$client->references->countries();
$client->references->businessTypes();
```

Webhooks
--------

[](#webhooks)

Verify and process incoming webhook events:

```
$payload = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_MALIPOPAY_SIGNATURE'] ?? '';

try {
    $event = $client->webhooks->constructEvent($payload, $signature);

    switch ($event['type']) {
        case 'payment.completed':
            // Handle completed payment
            break;
        case 'payment.failed':
            // Handle failed payment
            break;
        case 'collection.completed':
            // Handle completed collection
            break;
        case 'disbursement.completed':
            // Handle completed disbursement
            break;
        case 'invoice.paid':
            // Handle paid invoice
            break;
    }

    http_response_code(200);
} catch (\Malipopay\Exceptions\MalipopayException $e) {
    http_response_code(400);
}
```

### Webhook Event Types

[](#webhook-event-types)

EventDescription`payment.initiated`Payment has been initiated`payment.completed`Payment completed successfully`payment.failed`Payment failed`payment.reversed`Payment was reversed`collection.completed`Collection completed`collection.failed`Collection failed`disbursement.completed`Disbursement completed`disbursement.failed`Disbursement failed`invoice.paid`Invoice was fully paid`invoice.overdue`Invoice is overdueError Handling
--------------

[](#error-handling)

All errors extend `Malipopay\Exceptions\MalipopayException`:

```
use Malipopay\Exceptions\AuthenticationException;
use Malipopay\Exceptions\ValidationException;
use Malipopay\Exceptions\RateLimitException;
use Malipopay\Exceptions\MalipopayException;

try {
    $client->payments->collect([...]);
} catch (AuthenticationException $e) {
    // 401 - Invalid API key
} catch (ValidationException $e) {
    // 422 - Check $e->getFields() for field-level errors
} catch (RateLimitException $e) {
    // 429 - Retry after $e->getRetryAfter() seconds
} catch (MalipopayException $e) {
    // Any other API error
    echo $e->getMessage();
    echo $e->getStatusCode();
}
```

### Exception Classes

[](#exception-classes)

ExceptionHTTP StatusDescription`AuthenticationException`401Invalid or missing API key`PermissionException`403Insufficient permissions`NotFoundException`404Resource not found`ValidationException`422Validation failed (check `getFields()`)`RateLimitException`429Rate limit exceeded (check `getRetryAfter()`)`ApiException`5xxServer error`ConnectionException`-Network/timeout errorTesting
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

MIT - see [LICENSE](LICENSE) for details.

Copyright (c) 2026 Lockwood Technology Ltd.

---

See Also
--------

[](#see-also)

SDKInstall[Node.js](https://github.com/Malipopay/malipopay-node)`npm install malipopay`[Python](https://github.com/Malipopay/malipopay-python)`pip install malipopay`[PHP](https://github.com/Malipopay/malipopay-php)`composer require malipopay/malipopay-php`[Java](https://github.com/Malipopay/malipopay-java)Maven / Gradle[.NET](https://github.com/Malipopay/malipopay-dotnet)`dotnet add package Malipopay`[Ruby](https://github.com/Malipopay/malipopay-ruby)`gem install malipopay`[API Reference](https://developers.malipopay.co.tz) | [OpenAPI Spec](https://github.com/Malipopay/malipopay-openapi) | [Test Scenarios](https://github.com/Malipopay/malipopay-sdk-tests)

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance89

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity40

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 ~2 days

Total

2

Last Release

56d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c9dae0b1b9a3da6f5d874473818e24fea2655b44254b017a6af34bda0037d4a5?d=identicon)[Malipopay](/maintainers/Malipopay)

---

Top Contributors

[![mwakatumbula](https://avatars.githubusercontent.com/u/21016136?v=4)](https://github.com/mwakatumbula "mwakatumbula (5 commits)")

---

Tags

sdkpaymentsmobile-moneytanzaniafintechmalipopay

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/malipopay-malipopay-php/health.svg)

```
[![Health](https://phpackages.com/badges/malipopay-malipopay-php/health.svg)](https://phpackages.com/packages/malipopay-malipopay-php)
```

###  Alternatives

[tatter/stripe

Stripe SDK integration for CodeIgniter 4

115.3k](/packages/tatter-stripe)

PHPackages © 2026

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