akika/laravel-ncba
Composer 安装命令:
composer require akika/laravel-ncba
包简介
The Laravel NCBA package allows you to transfer money through the NCBA Open Banking APIs. The package supports Laravel version 5 and above.
README 文档
README
The Laravel NCBA package allows you to transfer money through the NCBA Open Banking APIs. The package supports Laravel version 5 and above.
Installation
You can install the package via composer:
composer require akika/laravel-ncba
After installing the package, publish the configuration file using the following command:
php artisan ncba:install
This will import ncba.php config file in your project config directory where you can set your NCBA related parameters and other configuration options.
.env file Setup
Add the following configurations into your .env file
NCBA_ENV= # This value is either sandbox or production. This config variable - This is required to enable Laravel NCBA pick the required variables. NCBA_DEBUG= # This value is true or false. If true, the app will write debug logs. NCBA_SANDBOX_API_KEY= # The provided sandbox API Key. Contact NCBA for this key. NCBA_SANDBOX_USERNAME= # Sandbox username NCBA_SANDBOX_PASSWORD= # Sandbox password NCBA_SANDBOX_URL= # Sandbox API URL NCBA_PRODUCTION_API_KEY= # You will reveive this key after you are fully onboarded onto NCBA Online Banking API. NCBA_PRODUCTION_USERNAME= # Production username NCBA_PRODUCTION_PASSWORD= # Production password NCBA_PRODUCTION_URL= # Production API URL
Package Upgrade
To upgrade Laravel NCBA Package to the latest version, run the following command
composer update akika/laravel-ncba
Usage
Initialize NCBA
use Akika\LaravelNcba\Ncba; // You can initialize the class without passing any parameters. In this case, you must ensure the credentials are in the .env file $ncba = new Ncba(); // or // You can also override the variables as shown below. In this case, the package will ignore the variables in the config file. $ncba = new Ncba($apiKey, $username, $password);
- The packag will process the credentials from the config variables provided
Authentication
An AP token is required to authenticate and use NCBA API's. Below is how to authenticate.
$ncba->authenticate();
Account Details
Gets account details including account balance.
$ncba->accountDetails($apiToken, $countryCode, $accountNo);
Mini Statement
Gets a mini statement for the account
$ncba->miniStatement($apiToken, $countryCode, $accountNo);
Account Statement
Gets an account statement based on the the specified period of time. The date format is 'ddmmyyyy'
$ncba->accountStatement($apiToken, $countryCode, $accountNo, $fromDate, $toDate);
Check Transaction Status
$ncba = new Ncba(); $response = $ncba->checkTransactionStatus($apiToken, $countryCode, $transactionID);
Success Response
Below is a sample result for a successful transaction.
{
"ErrorCode": "000",
"ErrorMessage": "Success",
"TransactionId": "String",
"CoreReference": "String",
}
Below is a transaction successful result
{
"resultCode": "000",
"statusDescription": "SUCCESS",
"cbxReferenceNumber": "IFT123454-3",
"txnReferenceNo": "FTX24211TAACS"
}
Send Money to Another NCBA Customer (Internal Transfer)
$ncba = new Ncba(); $response = $ncba->ift($apiToken, $country, $transactionID, $beneficiaryAccountNumber, $beneficiaryAccountName, $senderAccountNumber, $currency, $amount $narration);
IFT Payment rules
- The following rules apply when using the Laravel NCBA package
- Transaction can be settled in all major currencies, i.e. KES, UGX, TZS, RWF, EUR, GBP & USD.
- Settlement is immediate; real-time.
- Payments will be within country of origin, local b2b.
- Minimum payments of KES. 50 or its equivalent in other currency, no limit on Maximum payment.
- Transactions processing is 24/7 – 365, including weekends and public holidays.
Send Money to a Non-NCBA Customer (External Transfer)
$ncba = new Ncba(); $response = $ncba->eft($apiToken, $amount, $beneficiaryAccountNumber, $beneficiaryBankBic, $beneficiaryName, $currency, $senderAccountNumber, $narration, $senderCountry, $transactionID, $senderCIF);
EFT payment rules.
- Transaction can be settled in only in local currency, KES, UGX, TZS & RWF.
- Settlement is processed T+ 1 day.
- Payments will be within country of origin, local b2b.
- Minimum payments of KES. 50 or its equivalent in other currency and a maximum of KES. 999,999 or it’s equivalent in other local currency.
- Transactions processing is only on working days, Monday – Friday, excluding Weekends and Public Holidays.
Send Money via RTGS (External Transfer)
$ncba = new Ncba(); $response = $ncba->rtgs($apiToken, $beneficiaryAccountNumber, $beneficiaryBankBIC, $beneficiaryCountry, $beneficiaryName, $creditAmount, $creditCurrency, $debitCurrency, $narration, $senderAccountNumber, $senderCIF, $senderCountry, $purposeCode, $transactionID);
Payment Rules
- The following rules apply when using the Laravel NCBA package
- Transaction settled in KES, USD,GBP,EUR,TZS,UGX & RWF.
- Settlement is T+ 3hours on a working day, typically Monday – Friday before 15.00 HRS EAT.
- Payments will be within Country of Origin.
- Minimum payments of KES. 50 or its equivalent in any other acceptable currency with no maximum CAP.
- Purpose of Payment Code (POP) will be required for all outgoing payments - The list of POP codes to be maintained to be shared during onboarding.
Send Money via Pesalink (External Transfer)
$ncba = new Ncba(); $response = $ncba->pesalink($apiToken, $beneficiaryAccountNumber, $beneficiaryBankBIC, $beneficiaryName, $amount, $currency, $narration, $senderAccountNumber, $senderCIF, $senderCountry, $transactionID);
Pesalink payment rules
- Transaction settled in KES only.
- Settlement is processed immediately.
- Payments will be within Kenya only.
- Minimum payments of KES. 50 or its equivalent in other currency and a maximum of KES. 999,999 or it’s equivalent in other local currency.
- Payments are settled 24/7-365, including weekends and public holidays.
Sample Responses
Successful Transaction Sample Response
{
"Response Code":0,
"Reference":"FTC250124JEQT",
"Description":"Success"
}
Unsuccessful Transaction Sample Response
{
"Response Code":11,
"Reference":"DUPLICATE | FTC210920APDH",
"Description":"ERROR"
}
Transaction Status API Response
{
"Code": "000",
"Description": "Success",
"Transaction": {
"Currency": "KES",
"Amount": "100",
"Date": "1/24/2025 12:37:21 PM",
"AccountNumber": "7810710012",
"Narrative": "Other",
"CustomerReference": "250124093719",
"CBSReference": "FTC250124JEQS",
"ThirdPartyReference": null,
"Status": "PASSED",
"ThirdPartyStatus": null
}
}
KPLC Postpaid
NCBA offers a two-step API request as follows:
KPLC postpaid validation
/** * ... * @param $msisdn - the mobile number attached to the meter */
$ncba->kplcPostpaidValidation($apiToken, $meterNumber, $msisdn);
KPLC postpaid payment request
$ncba->kplcPostpaid($apiToken, $validationId, $customerName, $meterNumber, $msisdn, $channelRef, $amount, $callbackUrl, $accountNumber, $reason = '');
License
The Laravel NCBA package is open-sourced software licensed under the MIT license. See the LICENSE file for details.
akika/laravel-ncba 适用场景与选型建议
akika/laravel-ncba 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 443 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 01 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「payment」 「digital」 「Akika」 「ncba」 「ncba php」 「ncba laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 akika/laravel-ncba 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 akika/laravel-ncba 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 akika/laravel-ncba 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel package to easily integrate Xendit payment gateway. It supports credit and debit cards, and e-wallet payments and custom invoices, queued notifications, webhook listeners and more.
Zoho Sign v1 API PHP Wrapper - PHP 7.4 Ready
Sendrill DB
Extends TYPO3 with a new content object XPATH for flexible querying of XML
Extends TYPO3 with a new content object XSLT for flexible XML transformations
A single-tenant Laravel package for integrating Mpesa Daraja API. The package supports Laravel version 5 and above.
统计信息
- 总下载量: 443
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-01-21