1. Go to this page and download the library: Download datavisionint/laravel-mlipa 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/ */
datavisionint / laravel-mlipa example snippets
use DatavisionInt\Mlipa\Models\MlipaCollection;
use DatavisionInt\Mlipa\Models\MlipaPayout;
return [
/**
* The client key from the mlipa developer portal
*/
'client_key' => env('MLIPA_CLIENT_KEY'),
/**
* The client secret from the mlipa developer portal
*/
'client_secret' => env('MLIPA_CLIENT_SECRET'),
/**
* Webhook route
*
* The route exposed in your application that will be used to receive webhooks
*/
'webhook_route' => 'mlipa/webhook',
/**
* Webhook route name
*
* The route name used for webhook when using route() method
*/
'webhook_route_name' => 'mlipa.webhook',
/**
* Payout route
*
* The route exposed in your application that will be used to verify payouts
*/
'payout_verification_route' => 'mlipa/payouts/verification',
/**
* Payout route name
*
* The route name used for payout verification when using route() method
*/
'payout_verification_route_name' => 'mlipa.payouts.verification',
/**
* When set to false errors will be thrown when they occur and you will have to
* handle them yourself using try catch blocks, and when set to true, the errors
* will be silently handled and false status will be returned. The error can be found
* in the logs.
*/
'handle_errors' => true,
/**
* When set to true, the transactions will be logged to database, and you will be
* out request
*/
'payout' => '/v2/payouts/create',
/**
* Collection reconcilliation endpoint
*
* The endpoint used for collection reconcilliation
*/
'collection_reconcilliation' => '/v2/reconciliation/collection',
/**
* Payout reconcilliation endpoint
*
* The endpoint used for payout reconcilliation
*/
'payout_reconcilliation' => '/v2/reconciliation/payout',
],
/**
* Default heades sent to M-Lipa
*/
'default_headers' => [
/**
* Accept application/json response from M-Lipa
*/
'Accept' => 'application/json',
/**
* The content type we are sending is application/json
*/
'Content-Type' => 'application/json',
],
];
Mlipa::verifyPayoutUsing(function(string $reference, bool $isTransactionValid): bool{
// some code to verify the transaction
return $isTransactionValid;
});