1. Go to this page and download the library: Download myckhel/laravel-mono 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/ */
use Myckhel\Mono\Support\Cac;
Cac::lookup($params);
Cac::company($id, $params);
use Myckhel\Mono\Support\Payment;
Payment::initiate($params);
Payment::verify($params);
Payment::oneTimePayment($params);
Payment::createPlan($params);
Payment::listPlans($params);
Payment::updatePlan($params);
Payment::deletePlan($params);
use Myckhel\Mono\Support\Wallet;
Payment::balance($params);
use Mono;
Mono::verifyWebHook($request->header('mono-webhook-secret'));
namespace App\Listeners;
use Myckhel\Mono\Events\Hook;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Facades\Log;
class MonoWebHookListener
{
/**
* Handle the event.
*
* @param Myckhel\Mono\Events\Hook $event
* @return void
*/
public function handle(Hook $event)
{
Log::debug($event->event);
/* {
"event": "direct_debit.payment_successful",
"data": {
"type": "onetime-debit",
"object": {
"id": "txd_9AhCg0PNkwHiq6RqLLdiqKDf",
"status": "successful",
"amount": 30000,
"description": "free shirt",
"fee": 300,
"currency": "NGN",
"account": "611d575feef5d3371ca9d0d8",
"customer": "611adcd9a5fda23baf58140d",
"reference": "djdjj3939394949944",
"liveMode": true,
"created_at": "2021-08-18T18:54:23.491Z",
"updated_at": "2021-08-18T18:55:16.055Z"
}
}
}
*/
}
}
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
use Myckhel\Mono\Events\Hook;
use App\Listeners\MonoWebHookListener;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
...
Hook::class => [
MonoWebHookListener::class,
],
];