PHP code example of hngx / moneywave-php

1. Go to this page and download the library: Download hngx/moneywave-php 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/ */

    

hngx / moneywave-php example snippets


$mw = new \HngX\Moneywave\Moneywave($yourApiKey, $yourSecretKey);


//we want to perform a wallet to account transfer
$tran = new \HngX\Moneywave\Transactions\WalletToAccountTransaction($mw, $walletPassword);

//set details
$tran->amount = 25000;
$tran->bankcode = \HngX\Moneywave\Bank::STERLING;
$tran->accountNumber = "000056050";
$tran->senderName = "Johnson";
$tran->ref = 40;

//then make the transaction
$tran->dispatch();

//or you could do this in a batch
$tran->setDetails(array(
  "amount" => 25000,
  "bankcode" => \HngX\Moneywave\Bank::STERLING,
  "accountNumber" => "000056050",
  "senderName" => "Johnson",
  "ref" => 40
))->dispatch();

//we want to check our wallet balance
$bal=new \HngX\Moneywave\Resources\GetWalletBalance($mw);
$bal->dispatch();

$tran->getResponse();

/*
[
  "status" => "success",
  "data" => [
    ...]
  ]
*/

$tran->getStatus(); // -> "success" or "error"

if ($tran->successful()) {
  //yay!
} else {
  print_r($tran->getResponse());
}

$tran = new \HngX\Moneywave\AccountToAccountTransaction($mw);
$tran->setDetails([
    "firstname" => "Donald",
    "lastname" => "Trump",
    ...
  ])
  ->dispatch();
if ($tran->successful()){
  $tran->validate([
    "transactionRef" => $tran->getResponse()["data"]["ref"],
    "authType" => "OTP",
    "authValue" => "7489",
  ]);
}

composer