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.
-
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
- 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
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 β°
2.5% + 1 ZMW per transaction (reduced from the initial
3.5%)
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 |
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
-
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"; }
{
"message": "Transaction successful",
"data": {
"amount": "5.00",
"customer_name": "Blessed Mwanza",
"customerMobileWallet": "0769641179",
"reference": "0762611179_1713450343",
"status": "successful"
},
"isError": false
}
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"; }
{
"message": "Transaction pending OTP confirmation",
"data": {
"amount": "1.00",
"customer_name": "Dilip Okafor",
"customerMobileWallet": "260975555555",
"reference": "0975555555_1713447717",
"status": "otp-required"
},
"isError": false
}
To settle the current virtual account balance, use the settleFunds
method:
-
Settle Funds:
$settleParams = [ 'moneyunify_email' => '[email protected]', // 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"; }
{
"message": "Transaction successful",
"data": {
"amount": "9.29",
"customer_name": "BLESSED MWANZA",
"customerMobileWallet": "0971943638",
"reference": "Settlement_0971943638_1713460876",
"status": "successful"
},
"isError": false
}
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.
π€ Blessed Jason Mwanza - show support ππ Buy him a Coffee
- LinkedIn: Connect with Blessed on LinkedIn
- Github: @blessedjasonmwanza
- Twitter: Follow Blessed Jason @mwanzabj
- Youtube: Youtube
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.
If you find this library helpful, consider supporting it by sharing it with others or donating. Your support is greatly appreciated!