blessedjasonmwanza / moneyunify
Payments API with primary focus on Mobile Money USSD payments.
Requires
- php: >=7.4
Requires (Dev)
- pestphp/pest: ^3.4
This package is auto-updated.
Last update: 2025-07-21 22:40:46 UTC
README
The MoneyUnify Payments API library provides an easy interface for integrating with the MoneyUnify API to process mobile money payments. This documentation will guide you through the installation process and demonstrate how to use the library effectively. Support for multiple programming languages is available here.
-
MoneyUnify - Payments in Zambia (Recommended for businesses/individuals in Zambia)
Instant settlements and repayments
Ideal for money collections in Zambia - Coming soon to Tanzania, Nigeria, Kenya π
- Make Collections - Request mobile Money payments from AIRTEL, MTN, & ZAMTEL (All Network operators in Zambia)
- Settle Funds - Disburse and settle funds from your MoneyUnify Account to MTN, Zamtel, MTN All Mobile Networks Instantly
- π€ Instant Customer support available via - π WhatsApp
SETUP
- It's easy and instant! π Just Create your account on MoneyUnify to get your API key (MUID)
- π Check documentation below or here for more languages - Comes with some examples π
- π€ Customer support available via - π WhatsApp
Supported Countries on the MoneyUnify Endpoint
Country Country Code Currency Currency Code Status ZAMBIA ZM Zambian Kwacha ZMW Active βοΈ TANZANIA TZ Tanzanian Shilling TZS Coming Soon β° KENYA KE Kenyan Shilling KES Coming Soon β°
Table of Contents
Charges and Fees
Collections (Receiving Payments)
2.5% + 1 ZMW per transaction (reduced from the initial
3.5%)
Settlements / Transferring to Mobile Money
Settlement Account Balance | What You'll Receive | Charges/Transaction Fees |
---|---|---|
Balance [20 ZMW ~ 1,000 ZMW] | Balance - 12 | 12 ZMW |
Balance [1,000 ZMW ~ 50,000 ZMW] | Balance - 20 | 20 ZMW |
Balance [50,000 ~ 100,000 ZMW] | Balance - 30 | 30 ZMW |
Installation
Documentation usage for languages other than PHP is available here.
-
Install Composer (if you havenβt already). Follow the Composer installation guide.
-
Install the MoneyUnify Library by adding it to your
composer.json
:composer require blessedjasonmwanza/moneyunify
Usage
Basic Usage
-
Include the Autoload File:
require 'vendor/autoload.php'; // Include Composer autoload
-
Create an Instance of the
MoneyUnify
Class:use Blessedjasonmwanza\MoneyUnify\MoneyUnify; $muid = 'your_unique_muid'; // Replace with your actual MUID - obtain it at https://MoneyUnify.com $moneyUnify = new MoneyUnify($muid);
-
Call the
requestPayment
Method:$payerPhoneNumber = '0xxxxxxxx'; // Replace with payer's phone number $amountToPay = '10'; // Amount to be paid $response = $moneyUnify->requestPayment($payerPhoneNumber, $amountToPay);
-
Check the Response:
if ($response->isError) { echo "Error: " . $response->message . "\n"; echo "Console: " . ($response->console ?? 'No console message to debug') . "\n"; } else { echo "Success: " . $response->message . "\n"; echo "Data: " . json_encode($response->data) . "\n"; }
Example Successful Response
{ "message": "Transaction successful", "data": { "amount": "5.00", "customer_name": "Blessed Mwanza", "customerMobileWallet": "0769641179", "reference": "0762611179_1713450343", "status": "successful" }, "isError": false }
Verifying a Payment
To verify a payment, use the verifyPayment
method:
-
Verify the Payment:
$transactionReference = 'your_transaction_reference'; // Replace with transaction reference $verificationResponse = $moneyUnify->verifyPayment($transactionReference);
-
Check the Verification Response:
if ($verificationResponse->isError) { echo "Error: " . $verificationResponse->message . "\n"; echo "Console: " . ($verificationResponse->console ?? 'No console message to debug') . "\n"; } else { echo "Verification Success: " . $verificationResponse->message . "\n"; echo "Data: " . json_encode($verificationResponse->data) . "\n"; }
Example Verification Response
{ "message": "Transaction pending OTP confirmation", "data": { "amount": "1.00", "customer_name": "Dilip Okafor", "customerMobileWallet": "260975555555", "reference": "0975555555_1713447717", "status": "otp-required" }, "isError": false }
Settling Funds
To settle the current virtual account balance, use the settleFunds
method:
-
Settle Funds:
$settleParams = [ 'moneyunify_email' => 'your_email@example.com', // Replace with your MoneyUnify email 'receiver_first_name' => 'Blessed', 'receiver_last_name' => 'Mwanza', 'receiver_phone_number' => '0971943638', // Replace with receiver's phone number 'transaction_details' => 'Settling funds to the specified account.' ]; $settlementResponse = $moneyUnify->settleFunds($settleParams);
-
Check the Settlement Response:
if ($settlementResponse->isError) { echo "Error: " . $settlementResponse->message . "\n"; echo "Console: " . ($settlementResponse->console ?? 'No console message to debug') . "\n"; } else { echo "Settlement Success: " . $settlementResponse->message . "\n"; echo "Data: " . json_encode($settlementResponse->data) . "\n"; }
Example Successful Settlement Response
{ "message": "Transaction successful", "data": { "amount": "9.29", "customer_name": "BLESSED MWANZA", "customerMobileWallet": "0971943638", "reference": "Settlement_0971943638_1713460876", "status": "successful" }, "isError": false }
Conclusion
The MoneyUnify library simplifies the process of integrating with the Money Unify API. By following the steps outlined in this documentation, you can easily set up and make payment requests, verify transactions, and settle funds. For further assistance, feel free to reach out or check the official documentation for more advanced features.
Author
Author
π€ Blessed Jason Mwanza - show support ππ Buy him a Coffee
- LinkedIn: Connect with Blessed on LinkedIn
- Github: @blessedjasonmwanza
- Twitter: Follow Blessed Jason @mwanzabj
- Youtube: Youtube
π€ Contributing
Feel free to contribute to this project by submitting a pull request. Your contributions help improve the library and enhance the experience for all users!
Feature requests are welcome! Check the issues page or request a feature by creating a new issue.
Show your Support
If you find this library helpful, consider supporting it by sharing it with others or donating. Your support is greatly appreciated!