PHP code example of akika / laravel-mwaloni

1. Go to this page and download the library: Download akika/laravel-mwaloni library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

akika / laravel-mwaloni example snippets


use Akika\LaravelMwaloni\Mwaloni; // Paste before class definition

/**
 *
   * Initialize the Mwaloni class using credentials provided
   *
   * @param string $serviceId
   * @param string $username
   * @param string $password
   * @param string $apiKey
   */

$mwaloni = new Mwaloni($serviceId, $username, $password, $apiKey); // Paste code where appropriate in your code.

$response = $mwaloni->authenticate();


/**
 *
   * Set the API token
   *
   * @param string $token
   */

$response = $mwaloni->setToken($token); // $data->token

$response = $mwaloni->fetchBalance();

/**
 *
   * Send money to a mobile number
   *
   * @param string $orderNumber - The order number
   * @param string $phoneNumber - The phone number
   * @param float $amount - The amount to send
   * @param string $description - The description of the transaction
   *
   * @return mixed
   */

$response = $mwaloni->mobile($orderNumber, $phoneNumber, $amount, $description);


/**
   *
   * Send money to a till number
   *
   * @param string $orderNumber - The order number
   * @param string $accountName - The name of the account holder
   * @param string $accountNumber - The till number
   * @param float $amount - The amount to send
   * @param string $description - The description of the transaction
   *
   * @return mixed
   */

$response = $mwaloni->till($orderNumber, $accountName, $accountNumber, $amount, $description);

/**
   *
   * Send money to a paybill number
   *
   * @param string $accountReference - The account reference
   * @param string $orderNumber - The order number
   * @param string $accountName - The name of the account holder
   * @param string $accountNumber - The paybill number
   * @param float $amount - The amount to send
   * @param string $description - The description of the transaction
   *
   * @return mixed
   */

$response = $mwaloni->paybill($accountReference, $orderNumber, $accountName, $accountNumber, $amount, $description);

/**
 *
   * Send money to a bank account through ift
   *
   * @param string $orderNumber - The order number
   * @param string $accountName - The name of the account holder
   * @param string $accountNumber - The account number
   * @param string $address - The address of the account holder
   * @param string $countryCode - The country code
   * @param float $amount - The amount to send
   * @param string $currencyCode - The currency code
   * @param string $description - The description of the transaction
   *
   * @return mixed
   */

$response = $mwaloni->ift($orderNumber, $accountName, $accountNumber, $address, $countryCode, $amount, $currencyCode, $description);


/**
 *
   * Send money to a bank account through eft
   *
   * @param string $orderNumber - The order number
   * @param string $accountNumber - The account number
   * @param string $accountName - The name of the account holder
   * @param string $bankCode - The bank code
   * @param string $bankName - The name of the bank
   * @param string $bankCountryCode - The country code of the bank
   * @param string $bankCIF - The CIF/Swift Code of the bank
   * @param string $accountAddress - The address of the account holder
   * @param float $amount - The amount to send
   * @param string $currencyCode - The currency code
   * @param string $description - The description of the transaction
   *
   * @return mixed
   */

$response = $mwaloni->eft($orderNumber, $accountNumber, $accountName, $bankCode, $bankName, $bankCountryCode, $bankCIF, $accountAddress, $amount, $currencyCode, $description);


/**
   *
   * Send money to a bank account through pesalink
   *
   * @param string $orderNumber - The order number
   * @param string $accountNumber - The account number
   * @param string $accountName - The name of the account holder
   * @param string $bankName - The name of the bank
   * @param string $bankCountryCode - The country code of the bank
   * @param string $bankCIF - The CIF/Swift Code of the bank
   * @param float $amount - The amount to send
   * @param string $currencyCode - The currency code
   * @param string $description - The description of the transaction
   *
   * @return mixed
*/

$response = $mwaloni->pesalink($orderNumber, $accountNumber, $accountName, $bankName, $bankCountryCode, $bankCIF, $amount, $currencyCode, $description);


/**
   *
   * Send money to a bank account through rtgs
   *
   * @param string $orderNumber - The order number
   * @param string $accountNumber - The account number
   * @param string $accountName - The name of the account holder
   * @param string $bankName - The name of the bank
   * @param string $swiftCode - The swift code of the bank
   * @param string $address - The address of the account holder
   * @param string $bankCountryCode - The country code of the bank
   * @param float $amount - The amount to send
   * @param string $currencyCode - The currency code
   * @param string $description - The description of the transaction
   *
   * @return mixed
*/

$response = $mwaloni->rtgs($orderNumber, $accountNumber, $accountName, $bankName, $swiftCode, $address, $bankCountryCode, $amount, $currencyCode, $description);

/**
 * Send money to a Stanbic bank account
   * 
   * @param string $orderNumber - The order number
   * @param string $bankName - The name of the bank
   * @param string $accountNumber - The account number
   * @param string $accountName - The name of the account holder
   * @param string $bankCode - The bank code
   * @param float $amount - The amount to send
   * @param string $description - The description of the transaction
   */
$response = $mwaloni->sendStanbic($orderNumber, $bankName, $accountNumber, $accountName, $bankCode, $amount, $description)

/**
     * Send money via MTN Mobile Money
     *
     * @param string $orderNumber
     * @param string $accountNumber
     * @param float $amount
     * @param string $description
     * @return mixed
     */
$response = $mwaloni->sendMomo($orderNumber, $accountNumber, $amount, $description);


/**
 *
   * Fetch the status of a transaction
   *
   * @param string $orderNumber
   *
   * @return mixed
   */
$response = $mwaloni->getStatus($orderNumber);

/**
 *
   * Send money to a KPLC postpaid account
   *
   * @param string $meterNumber - The meter number
   * @param string $accountNumber - The account number
   * @param string $msisdn - The phone number attached to the account
   * @param float $amount - The amount to send
   *
   * @return mixed
   */

$response = $mwaloni->kplcPostpaid($meterNumber, $accountNumber, $msisdn, $amount);

/**
 *
   * Fetch the status of a transaction
   *
   * @param string $orderNumber
   *
   * @return mixed
   */
$response = $mwaloni->contactLookup($contact);


/**
 *
   * Send an SMS
   *
   * @param string $phone
   * @param string $message
   *
   * @return mixed
   */

$response = $mwaloni->sendSms($phone, $message);
bash
php artisan mwaloni:install