PHP code example of salymmbise / evpay

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

    

salymmbise / evpay example snippets




use EvMak\Client;

$client = new Client(
    "https://your-evmak-api-url.com",
    "your-username"
);

use EvMak\Payment;

$payment = new Payment($client);

$response = $payment->request([
    "api_source" => "WEBHOSTTZ",
    "api_to" => "TigoPesa", // Mpesa, AirtelMoney, HaloPesa
    "amount" => 1000,
    "product" => "TestPayment",
    "callback" => "https://yourdomain.com/callback",
    "mobileNo" => "255686668866",
    "reference" => uniqid("EVM")
]);

print_r($response);

use EvMak\Reconciliation;

$recon = new Reconciliation($client);

$status = $recon->check("EVM123456");

print_r($status);

Route::post('/callback', function (\Illuminate\Http\Request $request) {

    $data = $request->all();

    // Validate and store transaction
    // Recommended: verify hash and reference

    return response()->json([
        "Status" => "Success"
    ]);
});

md5(username . '|' . date('d-m-Y'));