gmbfgp / uabpayment
UAB Payment Integration Payment
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/gmbfgp/uabpayment
Requires
- guzzlehttp/guzzle: ^6.5 || ^7.0
This package is not auto-updated.
Last update: 2025-12-23 06:12:24 UTC
README
A Laravel package to integrate UAB TransactEase v1.7 Payment Gateway.
📑 Table of Contents
✅ Features
- Generate signed UAB payment form
- Secure callback and redirect signature verification
- Transaction status check
- Token-based login flow
- Designed for Laravel projects
📦 Installation
Install via Composer:
composer require gmbfgp/uabpayment
⚙️ Configuration
- Publish Config File:
php artisan vendor:publish --tag=uabpayment-config
- Add the following to your .env file:
UAB_MERCHANT_ID=your_merchant_id UAB_MERCHANT_CHANNEL=your_channel UAB_ACCESS_KEY=your_access_key UAB_SECRET_KEY=your_secret_key UAB_INS_ID=your_inst_id UAB_CLIENT_SECRET=your_client_secret UAB_PAYMENT_METHOD=your_payment_method UAB_PAYMENT_URL=https://uat-uab.com/ UAB_PAYMENT_CALLBACK_URL=https://uat-uab.com/your-callback UAB_PAYMENT_SUCCESS_URL=https://uat-uab.com/your-success UAB_PAYMENT_FAILED_URL=https://uat-uab.com/your-fail UAB_PAYMENT_EXPIRE=300
🚀 Example Usage
use App\Services\UabPaymentService; $uab = new UabPaymentService(); $form = $uab->uab(15000, [ 'BillToForename' => 'John', 'BillToSurname' => 'Depp', 'BillToPhone' => '9591234567', 'BillToEmail' => 'test@example.com', ]); // Blade View <form method="POST" action="{{ $form['url'] }}"> {!! $form['values'] !!} <button type="submit">Pay Now</button> </form>
🧰 Methods
- Generates the URL and signed form fields to initiate a UAB payment.
Example:
//input
Uabpayment::uab(10000, [
'BillToForename' => 'John',
'BillToSurname' => 'Depp',
'BillToPhone' => '9591234567',
'BillToEmail' => 'test@example.com',
]);
//output
[
'url' => 'https://{uab_url}/Payments/Request',
'values' => [
"<input type='hidden' id='amount' name='amount' value='10000' />
<input type='hidden' id='BillToForename' name='BillToForename' value='John' />
<input type='hidden' id='BillToSurname' name='BillToSurname' value='Depp' />
..."
]
]
- Validates the HMAC signature received from UAB in a callback.
Example:
//input $isValid = $uabService->checkCallbackSignature($request); //output true or false
- Validates the redirect signature (used in front-end return/cancel URLs).
Example:
//input $isValid = $uabService->checkRedirectSignature('GET', $request->all(), true); //status meaning status = true for success, false for failure. //output true or false
- Generates the sign string used before hashing, based on sorted key-value pairs.
Example:
//input $signString = Uabpayment::getSignString([ 'amount' => 10000, 'merchant_id' => 'UAB123456', 'timestamp' => '20250604140000', ]); //output "amount=10000,merchant_id=UAB123456,timestamp=20250604140000"
- Creates an HMAC hash using your app’s secret key.
Example:
//input $signString = "amount=10000,merchant_id=UAB123456,timestamp=20250604140000"; $signature = Uabpayment::hashSignature($signString); //output "f3a1a8a6d8b4f5c29e10b02c3d56cabc09ff2f7d"
- Generates a standard message information structure for UAB API requests.
//input $info = $uabService->generateMsgInfo('LOGIN'); //output [ 'VersionNo' => '1.0.0', 'MsgID' => 'MUAB1234567890123456000012', // Unique message ID 'TimeStamp' => '20250605123045', 'MsgType' => 'LOGIN', 'InsID' => 'UAB123456', ]
- Makes an API request to UAB's login endpoint to retrieve an access token using client credentials.
//input $token = $uabService->getLoginToken(); //output 'eyJhbGciOi...dXNzIn0.abc123' or null
- Fetches transaction status from UAB by RequestID.
//input $status = $uabService->getTransactionStatus('your_requestId');
🔒 Security Notes
-Always use checkCallbackSignature() on UAB’s callback endpoint.
-Ensure system time is synced to avoid signature mismatch errors.
-Never expose your secret key or credentials in frontend code.
📝 License
MIT License — See the LICENSE file for more information.
👨💻 Credits
Made by Pyae Sone Phyo for GMBF Tech.