Download the PHP package hngx/moneywave-php without Composer
On this page you can find all versions of the php package hngx/moneywave-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hngx/moneywave-php
More information about hngx/moneywave-php
Files in hngx/moneywave-php
Informations about the package moneywave-php
moneywave-php
PHP wrapper for the Moneywave API Please consult the official documentation for more details.
Contents
- Configuration
- Usage: Dispatching Transactions/Resources
- Usage: Handling Responses
- Usage: Errors
- Installation
- Bugs
Configuration
To carry out a transaction or access a resource, you will need an instance of the moneywave client This will be used for your API calls.
Usage: Dispatching Transactions/Resources
Performing Transactions
To perform a transaction, there are 3 simple steps:
-
Create the transaction. All transactions take the moneywave client instance as a constructor argument. The
WalletToAccountTransaction
andBulkWalletToAccountTransaction
transactions also take a second parameter: the wallet password -
Set the appropriate details All the fields listed for each transaction in the docs are available as properties on the transaction class (via magic methods), so you can set them individually. Alternatively, you could use the
setDetails()
function to set them in one go. Caution: be sure to use the exact parameter names (including capitalisation) as described at https://moneywave.flutterwave.com/api. The following fields are automatically set for you on each transaction:Field Default apiKey the API key used when creating the Moneywave
clientsecret the secret key used when creating the Moneywave
clientcurrency "NGN" lock (for WalletToAccountTransaction
andBulkWalletToAccountTransaction
) the wallet password supplied in the constructor - Dispatch the transaction by calling
dispatch()
Here is an example:
Available Transaction Types
Available bank codes
Here is the list of banks currently supported by the Moneywave API. Their codes are available as constants in the \HngX\Moneywavw\Bank
class:
Accessing a Resource
The same 3 steps apply:
-
Create the resource. All resources take the moneywave client instance as their only constructor argument.
-
Set the appropriate details, if any. The
GetWalletBalance
do not need any extra data All the fields listed for each resource in the docs are available as properties on the resource class (via magic methods), so you can set them individually. Alternatively, you could use thesetDetails()
function to set them in one go. Caution: be sure to use the exact parameter names (including capitalisation) as described at https://moneywave.flutterwave.com/api. The following fields are automatically set for you on each resource:Field Default apiKey the API key used when creating the Moneywave
clientsecret the secret key used when creating the Moneywave
client - Dispatch the resource by calling
dispatch()
.
Here is an example:
Available Resource Types
Usage: Handling Responses
After dispatching a transaction or resource, you may access the full response by calling getResponse()
on the object.
You can also find out the status
alone by calling getStatus()
.
You may also call successful()
directly to test if the status
of the response was success
:
Caution: According to Moneywave, "success" does not neccessarily mean The transaction has gone through. Consult the official docs for more details
Validating Transactions
According to the docs, the two transaction types AccountToAccountTransaction
and CardToAccountTransaction
may also need validation after being dispatched. To do that, simply call validate()
on the transaction object with the appropriate data:
Note: after this, calling getResponse()
or getStatus()
will return the response or status for the validation process
Usage: Errors
You will get an instance of \HngX\MoneywaveException
if you do anything naughty.
Installation
Bugs
If you notice any bugs, please create a new issue. We will attend to it promptly.