PHPackages                             bosunski/moneywave - 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. [API Development](/categories/api)
4. /
5. bosunski/moneywave

ActiveLibrary[API Development](/categories/api)

bosunski/moneywave
==================

A Testimplementation of the Moneywave API emmanix2002 by Flutterwave

v0.2.4(8y ago)125MITPHPPHP ~7.0

Since Feb 17Pushed 8y agoCompare

[ Source](https://github.com/bosunski/moneywave)[ Packagist](https://packagist.org/packages/bosunski/moneywave)[ Docs](https://github.com/emmanix2002/moneywave)[ RSS](/packages/bosunski-moneywave/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (7)Versions (17)Used By (0)

Moneywave
=========

[](#moneywave)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f635c90b87b9015f46c0f71c18da2fa8147720eaf676b39efcc48ab13d08d0e0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656d6d616e6978323030322f6d6f6e6579776176652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/emmanix2002/moneywave)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/b489998a4f4b9b21c4a0c7214f50e0fa6aba020613d7c371aca5cd441e05eadb/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f656d6d616e6978323030322f6d6f6e6579776176652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/emmanix2002/moneywave)[![Total Downloads](https://camo.githubusercontent.com/cecac239bc58c28d941b9c089079287397d509251d9d2971ff0e551b7cbffc4e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656d6d616e6978323030322f6d6f6e6579776176652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/emmanix2002/moneywave)

A PHP library for consuming the Moneywave API services.
You can check out the documentation to see all that is available:

- [Quickstart](#quickstart)
- [Introduction](#introduction)
- [Configuration](#configuration)
- [Usage](#usage)
- [Services](#services)
- [Handling Responses](#handling-responses)

Quickstart
------------------------------------------------

[](#quickstart)

To get started, you simply need to install it via `composer`:

```
$ composer require emmanix2002/moneywave

```

This will add it to your `composer.json` and install it as a project dependency.

Introduction
----------------------------------------------------

[](#introduction)

All the *Features* and *Resources* available on the **Moneywave** service are exposed as ***Services***. Hence, to use any of the services, it first needs to be created.

> All Features and Resources on the Moneywave API are exposed as services in this library.

The entry point to this library is the `Moneywave` class.

```
$moneywave = new Moneywave();

```

We'll discuss more about this later.

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

[](#configuration)

To use the library, you need to get your credentials from your Moneywave account. They provide you two keys:

- API Key
- Secret Key

Your account can be in one of two states: `Test` or `Production`. For each of these *states*, you'll use different **keys**.
These **keys** are required by the `Moneywave` class (and must be protected -- they are used to authenticate the merchant account); to use them with this library, you can use one of two possible methods.

#### Environment Variables

[](#environment-variables)

Using this method stores the key in a specific file on your server, meaning the values are not **hardcoded** into your code. The library expects to find a file called `.env` at the same level as your ***composer*** `vendor` directory.

```
.env
vendor/
composer.json
composer.lock

```

As you can see above, the setting file should be at the level described. The content of the file should be the same as you can find in the `.env.example` like so:

```
# your account Moneywave API key
MONEYWAVE_API_KEY="your API key goes here"
# your account Moneywave Secret key
MONEYWAVE_SECRET_KEY="your secret key goes here"
# the environment - staging | production
MONEYWAVE_ENV="staging"

```

Those values must be set to use the library; with this done, you can simply call:

```
$moneywave = new Moneywave();

```

#### Pass into the Constructor

[](#pass-into-the-constructor)

The second way to configure the Moneywave client is to pass all the settings into the constructor.
Unlike **method one**, you'll need to store the keys somewhere and provide them to the client when you instantiate it.

```
$moneywave = new Moneywave(null, $apiKey, $secretKey); # this defaults to the STAGING environment
$moneywave = new Moneywave(null, $apiKey, $secretKey, Environment::STAGING);

```

Usage
--------------------------------------

[](#usage)

When the client is instantiated (**see** [configuration](#configuration)), it automatically starts up the `VerifyMerchant` service. This service gets an `access token` from the Moneywave service that will be used to **authorize** every other request you make against the API.
Every `access token` has a lifespan of `2 hours`. In your application, you have one of 2 options:

- Save the retrieved token to your `Session` to use it across multiple requests
- Allow the library request one for every call made to the API

For the first option, take a look at the sample files in the `examples` directory. You'll see something like this:

```
use Emmanix2002\Moneywave\Exception\ValidationException;
use Emmanix2002\Moneywave\Moneywave;

require(dirname(__DIR__).'/vendor/autoload.php');
session_start();

try {
    $accessToken = !empty($_SESSION['accessToken']) ? $_SESSION['accessToken'] : null;
    $mw = new Moneywave($accessToken);
    $_SESSION['accessToken'] = $mw->getAccessToken();
    $query = $mw->createWalletBalanceService();
    $response = $query->send();
    var_dump($response->getData());
    var_dump($response->getMessage());
} catch (ValidationException $e) {
    var_dump($e->getMessage());
}

```

This makes it possible to use the same `access token` for another request from the same machine.

Services
--------------------------------------------

[](#services)

After instantiating the `Moneywave` object, you follow these steps to use a service:

- create an instance of the required service from it by calling one of the `create*Service()` methods
- set the properties on the **service object**
- call the `send()` method on the created **service object**.

Each feature and resource maps to a service; the mappings can be easily inferred from the **class name**.
The table below describes all the services:

Class NameService CallAccountNumberValidationcreateAccountNumberValidationServiceAccountToAccountcreateAccountToAccountServiceAccountToWalletcreateAccountToWalletServiceAccountTransfercreateAccountTransferServiceBankscreateBanksServiceCardToBankAccountcreateCardToBankAccountServiceCardTokenizationcreateCardTokenizationServiceCardToWalletcreateCardToWalletServiceCardTransfercreateCardTransferServiceDisbursecreateDisburseServiceDisburseBulkcreateDisburseBulkServiceInternetBankingToWalletcreateInternetBankingToWalletServiceQueryCardToAccountTransfercreateQueryCardToAccountTransferQueryDisbursementcreateQueryDisbursementServiceRetryFailedTransfercreateRetryFailedTransferServiceTotalChargeToCardcreateTotalChargeToCardServiceValidateCardTransfercreateValidateCardTransferServiceValidateTransfercreateValidateTransferServiceVerifyMerchantcreateVerifyMerchantServiceWalletBalancecreateWalletBalanceServiceEach service has a list of properties that must be set on it before it can be sent to the API; if one or more of these properties are not set, calling `send()` throws a `ValidationException`.
Let's use the `Account Number validation API` *resource* as an example:
From the documentation, the following properties are required:

Field NameDescriptionaccount\_numberthe account number of the senderbank\_codethe bank code of the account to resolveTo use the library, we'll do something like this:

```
$moneywave = new Moneywave();
$accountValidation = $moneywave->createAccountNumberValidationService();
$accountValidation->account_number = '0690000004';
$accountValidation->bank_code = Banks::ACCESS_BANK;
$response = $accountValidation->send();

```

If one of those fields was not set on the *service object*, a `ValidationException` exception would have been thrown.

> Every field defined within the Moneywave documentation (for a service) can be set as a property on the created service object.

#### Special Fields

[](#special-fields)

There are certain fields which are special, and do not need to be set by you (although you can choose to set them); they'll be automatically given their required value by the library. Find them listed below:

FieldDescriptionapiKeythis will be set to the API key used to instantiate the `Moneywave` objectsecretthis will be set to the secret key used for the `Moneywave` objectfeeset by **default** to `0`recipientfor the `createCardToWalletService`, this is set to `wallet` by defaultcurrencyautomatically set to Naira `Currency::NAIRA`#### Special Services

[](#special-services)

Just as there're special fields, there're also some special service objects, that present more than the regular: `send()` method.

#### Transfers (`createCardToBankAccountService()`, `createCardToWalletService()`)

[](#transfers-createcardtobankaccountservice-createcardtowalletservice)

These transfer services are special because, most times, they're *2-legged*. They involve the following steps:

1 The transfer leg 2 The validation leg

These steps work one after the other; and both steps must be completed to **complete** the transfer.
There're 2 services that take care of the `validation` leg; they are:

- `createValidateCardTransferService()`: allows you to validate a **card to wallet** or **card to account** transfer made with a *Verve* debit card
- `createValidateTransferService()`: allows you to validate a **card to wallet** or **card to account** transfer made with an account. That is, the **charge\_with** field was set to `ChargeMethod::ACCOUNT`.

So, when you receive a success response from the API after the *first leg*; you start the validate leg.

**NOTE**: For Mastercard and Visa card transfers, you'll receive a `authurl` key in the successful API response; you are to **redirect** to this URL for the payer to validate the transfer. After success or failure, the payer will be redirected back to the URL set in the `redirecturl` field of the transfer request.

##### createDisburseBulkService()

[](#createdisbursebulkservice)

This service is for disbursing cash from your `Moneywave` wallet to multiple bank accounts. It has a special method on it for adding the individual `beneficiary` accounts.

```
addRecipient(string $bankCode, string $accountNumber, float $amount, string $reference = null);

```

This method allows you to add each beneficiary account in turn:

```
$bulkDisbursement = $moneywave->createDisburseBulkService();
$bulkDisbursement->lock = 'wallet password';
$bulkDisbursement->ref = 'unique reference';    # suggestion: you could use a UUID; check out ramsey/uuid package
$bulkDisbursement->senderName = 'MoneywaveSDK';
$bulkDisbursement->addRecipient(Banks::ACCESS_BANK, '0690000004', 1)
                 ->addRecipient(Banks::ACCESS_BANK, '0690000005', 2);

```

Look at the `examples/disburse_bulk.php` file for the full example.

Handling Responses
----------------------------------------------------------------

[](#handling-responses)

If all the required fields on the **service object** (see [services](#services)) have been set, the call to `send()`will return a *response object* which is an instance of the `MoneywaveResponse` class.
Continuing with the *Account Validation* example above:

```
$response = $accountValidation->send();

```

A successful response `JSON` will be of this form:

```
{
    status: "success",
    data: {
        name: "MICHAEL JACKSON"
    }
}

```

While a failure response `JSON` will be of the form:

```
{
    status: "error",
    message: "error message description",
    code: "error code string; e.g. INVALID_ID",
    data: "data string -- this is absent most of the time"
}

```

The `$response` variable presents a few functions that can be used to work with this data:

```
# was a request successful?
if ($response->isSuccessful()) {
    # do something with the returned data
    $name = $response->getData()['name'];
} else {
    # this was a failure
    $message = $response->getMessage();
    $code = $response->getCode();
    $data = $response->getData();
}

```

***NOTE***: All keys within the response `JSON` are also accessible from the **response object** as properties:

```
if ($response->isSuccessful()) {
    $name = $response->getData()['name'];
} else {
    $message = $response->message;
    $code = $response->code;
}

```

As another example, the response from the `VerifyMerchant` service looks like this:

```
{
    status: "success",
    token: "" // a valid merchant token
}

```

Using the response, you'll have to do this:

```
$response = $verifyService->send();
if ($response->isSuccessful()) {
    $token = $response->token;
} else {
    # process the error response as you normally would
}

```

The table below describes the methods defined on the `MoneywaveResponse` object:

MethodReturn TypeDescriptiongetRawResponse()stringthe JSON response from the APIisSuccessful()boolchecks if the `status` key `=== "success"`getCode()stringreturns the `code` keygetMessage()stringreturns the `message` attributegetData()arrayreturns the `data` key**NOTE**: For responses where `data` is a string; it returns this array `[data: string]`

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.9% 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 ~26 days

Recently: every ~68 days

Total

14

Last Release

3025d ago

### Community

Maintainers

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

---

Top Contributors

[![emmanix2002](https://avatars.githubusercontent.com/u/456165?v=4)](https://github.com/emmanix2002 "emmanix2002 (52 commits)")[![bosunski](https://avatars.githubusercontent.com/u/15146515?v=4)](https://github.com/bosunski "bosunski (4 commits)")

---

Tags

financefintechflutterwaveemmanix2002Moneywave

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/bosunski-moneywave/health.svg)

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

###  Alternatives

[laravel/framework

The Laravel Framework.

34.6k509.9M17.0k](/packages/laravel-framework)[googleads/googleads-php-lib

Google Ad Manager SOAP API Client Library for PHP

67410.3M25](/packages/googleads-googleads-php-lib)[tempest/framework

The PHP framework that gets out of your way.

2.1k23.1k9](/packages/tempest-framework)[netflie/whatsapp-cloud-api

The first PHP SDK to send and receive messages using a cloud-hosted version of the WhatsApp Business Platform

640431.7k4](/packages/netflie-whatsapp-cloud-api)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

553.3M7](/packages/checkout-checkout-sdk-php)

PHPackages © 2026

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