A Laravel package for integrating with Areeba Payment Gateway.
This flow requires you to redirect the end-user to the payment page as advised in the redirectUrl response.
- Initiate the payment with the appropriate API call.
- Upon success, the Gateway responds with a result containing
returnTypeasREDIRECTand the URL inredirectUrl. - You redirect the user to the given URL (usually via a
Locationheader). - The user completes the payment process on the payment page.
- The Gateway sends an asynchronous status notification to the URL provided in the initial API call.
- The user will be redirected to the
successUrl,errorUrl, orcancelUrlbased on the transaction status. The URL will contain thetransactionIdas a query parameter:url?transactionId={{$transactionId}}.
You can install the package via Composer:
composer require thejano/areeba-payment-laravelPublish the configuration file:
php artisan vendor:publish --provider="TheJano\AreebaPayment\Providers\AreebaPaymentServiceProvider"This will create a config/areeba.php file.
Set your environment variables in .env:
AREEBA_API_KEY=your_api_key
AREEBA_USERNAME=your_username
AREEBA_PASSWORD=your_password
AREEBA_BASE_URL=https://gateway.areebapayment.com/api/v3
AREEBA_LANGUAGE=en
AREEBA_TRANSACTION_PREFIX=MYAPP-
AREEBA_SUCCESS_REDIRECT_URL=https://yourapp.com/payment/success
AREEBA_ERROR_REDIRECT_URL=https://yourapp.com/payment/error
AREEBA_CANCEL_REDIRECT_URL=https://yourapp.com/payment/cancel
AREEBA_CALLBACK_REDIRECT_URL=https://yourapp.com/payment/callbackuse 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);The AreebaPaymentRequestData contains the following properties:
success(bool) - Indicates if the request was successful.uuid(string|null) - Unique identifier for the transaction.purchaseId(string|null) - The purchase reference ID.returnType(string|null) - Type of return response (e.g.,REDIRECT).redirectUrl(string|null) - URL where the user should be redirected to complete payment.paymentMethod(string|null) - Payment method used by the user.errorMessage(string|null) - Error message in case of failure.errorCode(int|null) - Error code if the transaction failed.
Based on the transaction status, the user will be redirected to the appropriate URL with ?transactionId={{$transactionId}} appended.
use TheJano\AreebaPayment\Facades\AreebaPayment;
$checkResponse = AreebaPayment::checkPaymentStatus('TXN123456');This will return a JSON response including transactionStatus with possible values:
SUCCESS- Transaction was successful.REDIRECT- Transaction has not been processed yet.ERROR- Transaction failed.
This package is open-source and licensed under the MIT License.
For more details, visit the official API documentation: