PHP code example of thejano / areeba-payment-laravel

1. Go to this page and download the library: Download thejano/areeba-payment-laravel 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/ */

    

thejano / areeba-payment-laravel example snippets


use TheJano\AreebaPayment\Services\AreebaPayment;

$paymentData = AreebaPayment::make()->initiatePayment('TXN123456', '100.00', 'John Doe');

$paymentUrl = $paymentData->redirectUrl;

return redirect($paymentUrl);

use TheJano\AreebaPayment\Facades\AreebaPayment;

$paymentData = AreebaPayment::initiatePayment('TXN123456', '100.00', 'John Doe');

$paymentUrl = $paymentData->redirectUrl;

return redirect($paymentUrl);

use TheJano\AreebaPayment\Facades\AreebaPayment;

$checkResponse = AreebaPayment::checkPaymentStatus('TXN123456');

use TheJano\AreebaPayment\Services\AreebaMpgsPayment;

$paymentData = AreebaMpgsPayment::make()->initiatePayment('ORDER-123', '100.00', 'John Doe');

// $paymentData->purchaseId  → MPGS session id (use it with checkout.js)
// $paymentData->redirectUrl → hosted-checkout URL (use it for a plain redirect flow)
return redirect($paymentData->redirectUrl);

use TheJano\AreebaPayment\Facades\AreebaMpgsPayment;

$paymentData = AreebaMpgsPayment::initiatePayment('ORDER-123', '100.00', 'John Doe');

use TheJano\AreebaPayment\Facades\AreebaMpgsPayment;

// Hosted-checkout redirect URL
$paymentLink = AreebaMpgsPayment::getPaymentLink('ORDER-123', '100.00', 'John Doe');
if ($paymentLink === null) {
    abort(502, 'Payment gateway unavailable');
}
return redirect($paymentLink);

// MPGS session ID (for embedded checkout.js)
$sessionId = AreebaMpgsPayment::getSessionId('ORDER-123', '100.00', 'John Doe');
return view('checkout', ['sessionId' => $sessionId]);

use TheJano\AreebaPayment\Facades\AreebaMpgsPayment;

$response = AreebaMpgsPayment::checkPaymentStatus('ORDER-123');
// Inspect $response['status'] — values 
sh
php artisan vendor:publish --provider="TheJano\AreebaPayment\Providers\AreebaPaymentServiceProvider"
ini
AREEBA_DRIVER=mpgs