Official PHP client for the [Malipo One](
malipo.one) payments API — mobile money collection, payment links, refunds and balances for Tanzania.
# Malipo One PHP SDK
Official PHP client for the Malipo One payments API — mobile money collection, payment links, refunds and balances for Tanzania.
## Requirements
- PHP 8.1+
- Composer
## Installation
```bash
composer require malipo-one/php-sdk
```
## Quick Start
```php
use MalipoOne\Client;
$malipo = new Client(
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
);
```
Tokens are fetched and cached automatically. You never call `/oauth/token` yourself.
---
## Payment Links
Create a hosted payment page and share the URL with your customer:
```php
// Fixed-amount link (single payment, auto-closes after paid)
$link = $malipo->paymentLinks()->create([
'title' => 'Invoice #1234',
'amount' => 50000,
'business_id' => 12, // optional — auto-creates invoice
'description' => 'Web design services',
'expires_at' => '2026-12-31T23:59:59+03:00',
]);
echo $link['data']['url']; //
malipo.one
echo $link['data']['reference']; // ABCD1234
echo $link['data']['status']; // pending | paid | expired | cancelled
echo $link['data']['invoice_created']; // true
// Open-amount donation link (stays open for multiple payments)
$link = $malipo->paymentLinks()->create([
'title' => 'Donate to Our Cause',
'payment_mode' => 'multiple',
]);
// Retrieve a link by reference — poll `status` (or use a `payment.success`
// webhook) to confirm payment server-side. Do not treat a customer merely
// reaching `success_url` as proof of payment; that redirect is not signed
// or otherwise verifiable on its own.
$link = $malipo->paymentLinks()->get('ABCD1234');
```
The payer can cancel from the hosted page itself (there is no merchant
cancel endpoint). Cancelling redirects them to `cancel_url` if you set one,
sets `status` to `cancelled`, and closes the link.
---
## Payments (USSD Push)
Send a payment prompt directly to a customer's phone. **CRDB has no
USSD-push rail** — `operator: 'CRDB'` here will queue but n …