Native PHP library to integrate your application with the BCA (Bank Central Asia) system. For clearer and more complete documentation, please visit the official website at Developer BCA.
For the Laravel Framework, you can use the Odenktools Laravel BCA library.
If you feel helped by this library, don't forget to give a STAR for this library.
For more details, please visit php bca TravisCI
Get balance information
/fire/accounts/balance
Get beneficiary account's information
/fire/accounts
Get status of a transaction
/fire/transactions
Transfer funds directly to beneficiary account
/fire/transactions/to-account
Transfer funds to beneficiary to be taken personally
/fire/transactions/cash-transfer
Amend cash transfer transaction's details
/fire/transactions/cash-transfer/amend
Cancel cash transfer transaction
/fire/transactions/cash-transfer/cancel
Get status of payment by CompanyCode and CustomerNumber or RequestID
/va/payments?CompanyCode=&RequestID=
composer require " odenktools/php-bca " Before entering the LOGIN stage, make sure all requirements such as CORP_ID, CLIENT_KEY, CLIENT_SECRET, APIKEY, SECRETKEY are known.
$ options = array (
' scheme ' => ' https ' ,
' port ' => 443 ,
' host ' => ' sandbox.bca.co.id ' ,
' timezone ' => ' Asia/Jakarta ' ,
' timeout ' => 30 ,
' debug ' => true ,
' development ' => true
);
// Setting default timezone Anda
Bca BcaHttp:: setTimeZone ( ' Asia/Jakarta ' );
// ATAU
// BcaBcaHttp::setTimeZone('Asia/Singapore');
$ corp_id = " BCAAPI2016 " ;
$ client_key = " NILAI-CLIENT-KEY-ANDA " ;
$ client_secret = " NILAI-CLIENT-SECRET-ANDA " ;
$ apikey = " NILAI-APIKEY-ANDA " ;
$ secret = " SECRETKEY-ANDA " ;
$ bca = new Bca BcaHttp ( $ corp_id , $ client_key , $ client_secret , $ apikey , $ secret );
// ATAU
$ bca = new Bca BcaHttp ( $ corp_id , $ client_key , $ client_secret , $ apikey , $ secret , $ options );Using custom Curl Options
$ options = array (
' curl_options ' => array (
CURLOPT_SSL_VERIFYHOST => 0 ,
CURLOPT_SSLVERSION => 6 ,
CURLOPT_SSL_VERIFYPEER => false ,
CURLOPT_TIMEOUT => 60
),
' scheme ' => ' https ' ,
' port ' => 443 ,
' host ' => ' sandbox.bca.co.id ' ,
' timezone ' => ' Asia/Jakarta ' ,
' timeout ' => 30 ,
' debug ' => true ,
' development ' => true
);
// Setting default timezone Anda
Bca BcaHttp:: setTimeZone ( ' Asia/Jakarta ' );
// ATAU
// BcaBcaHttp::setTimeZone('Asia/Singapore');
$ corp_id = " BCAAPI2016 " ;
$ client_key = " NILAI-CLIENT-KEY-ANDA " ;
$ client_secret = " NILAI-CLIENT-SECRET-ANDA " ;
$ apikey = " NILAI-APIKEY-ANDA " ;
$ secret = " SECRETKEY-ANDA " ;
$ bca = new Bca BcaHttp ( $ corp_id , $ client_key , $ client_secret , $ apikey , $ secret , $ options ); $ corp_id = " CORP_ID-ANDA " ;
$ client_key = " NILAI-CLIENT-KEY-ANDA " ;
$ client_secret = " NILAI-CLIENT-SECRET-ANDA " ;
$ apikey = " NILAI-APIKEY-ANDA " ;
$ secret = " SECRETKEY-ANDA " ;
$ bca = new Bca BcaHttp ( $ corp_id , $ client_key , $ client_secret , $ apikey , $ secret );
// Request Login dan dapatkan nilai OAUTH
$ response = $ bca -> httpAuth ();
// Cek hasil response berhasil atau tidak
echo json_encode ( $ response ); After successful login, make sure you save the TOKEN value in a safe place, because the TOKEN value will be used for the next assignment.
Make sure you get the TOKEN value and the TOKEN is still valid (not expired).
// Ini adalah nilai token yang dihasilkan saat login
$ token = " MvXPqa5bQs5U09Bbn8uejBE79BjI3NNCwXrtMnjdu52heeZmw9oXgB " ;
//Nomor akun yang akan di ambil informasi saldonya, menggunakan ARRAY
$ arrayAccNumber = array ( ' 0201245680 ' , ' 0063001004 ' , ' 1111111111 ' );
$ response = $ bca -> getBalanceInfo ( $ token , $ arrayAccNumber );
// Cek hasil response berhasil atau tidak
echo json_encode ( $ response ); Make sure you get the TOKEN value and the TOKEN is still valid (not expired).
// Ini adalah nilai token yang dihasilkan saat login
$ token = " MvXPqa5bQs5U09Bbn8uejBE79BjI3NNCwXrtMnjdu52heeZmw9oXgB " ;
$ amount = ' 50000.00 ' ;
// Nilai akun bank anda
$ nomorakun = ' 0201245680 ' ;
// Nilai akun bank yang akan ditransfer
$ nomordestinasi = ' 0201245681 ' ;
// Nomor PO, silahkan sesuaikan
$ nomorPO = ' 12345/PO/2017 ' ;
// Nomor Transaksi anda, Silahkan generate sesuai kebutuhan anda
$ nomorTransaksiID = ' 00000001 ' ;
$ remark1 = ' Transfer Test Using Odenktools BCA ' ;
$ remark2 = ' Online Transfer Using Odenktools BCA ' ;
// value hanya support idr dan usd
$ mataUang = ' idr ' ;
$ response = $ bca -> fundTransfers ( $ token ,
$ amount ,
$ nomorakun ,
$ nomordestinasi ,
$ nomorPO ,
$ remark1 ,
$ remark2 ,
$ nomorTransaksiID ,
$ mataUang );
// Cek hasil response berhasil atau tidak
echo json_encode ( $ response ); For data remark1 , remark2 , nomorPO will be replaced to lowercase and whitespace removed
Make sure you get the TOKEN value and the TOKEN is still valid (not expired).
// Ini adalah nilai token yang dihasilkan saat login
$ token = " MvXPqa5bQs5U09Bbn8uejBE79BjI3NNCwXrtMnjdu52heeZmw9oXgB " ;
// Nilai akun bank anda
$ nomorakun = ' 0201245680 ' ;
// Tanggal start transaksi anda
$ startdate = ' 2016-08-29 ' ;
// Tanggal akhir transaksi anda
$ enddate = ' 2016-09-01 ' ;
$ response = $ bca -> getAccountStatement ( $ token , $ nomorakun , $ startdate , $ enddate );
// Cek hasil response berhasil atau tidak
echo json_encode ( $ response ); //Tipe rate : bn, e-rate, tt, tc
$ rateType = ' e-rate ' ;
$ mataUang = ' usd ' ;
$ response = $ bca -> getForexRate ( $ token , $ rateType , $ mataUang );
// Cek hasil response berhasil atau tidak
echo json_encode ( $ response ); $ latitude = ' -6.1900718 ' ;
$ longitude = ' 106.797190 ' ;
$ totalAtmShow = ' 10 ' ;
$ radius = ' 20 ' ;
$ response = $ bca -> getAtmLocation ( $ token , $ latitude , $ longitude , $ totalAtmShow , $ radius );
// Cek hasil response berhasil atau tidak
echo json_encode ( $ response ); Make sure you get the TOKEN value and the TOKEN is still valid (not expired).
// Ini adalah nilai token yang dihasilkan saat login
$ token = " MvXPqa5bQs5U09Bbn8uejBE79BjI3NNCwXrtMnjdu52heeZmw9oXgB " ;
$ response = $ bca -> getDepositRate ( $ token );
// Cek hasil response berhasil atau tidak
echo json_encode ( $ response );When useful for testing purposes.
$ secret = " NILAI-SECRET-ANDA " ;
// Ini adalah nilai token yang dihasilkan saat login
$ token = " MvXPqa5bQs5U09Bbn8uejBE79BjI3NNCwXrtMnjdu52heeZmw9oXgB " ;
$ uriSign = " GET:/general/info-bca/atm " ;
// Format timestamp harus dalam ISO8601 format (yyyy-MM-ddTHH:mm:ss.SSSTZD)
$ isoTime = " 2016-02-03T10:00:00.000+07:00 " ;
$ bodyData = array ();
//nilai body anda disini
$ bodyData [ ' a ' ] = " BLAAA-BLLLAA " ;
$ bodyData [ ' b ' ] = " BLEHH-BLLLAA " ;
//ketentuan BCA array harus disort terlebih dahulu
ksort ( $ bodyData );
$ authSignature = Bca BcaHttp:: generateSign ( $ uriSign , $ token , $ secret , $ isoTime , $ bodyData );
echo $ authSignature ; To carry out testing, do the following command
composer run-script testOr use PHPUnit
vendor/bin/phpunit --verbose --coverage-textFor an example of the commandline:
git remote add fork [email protected]: $USER /php-bca.git # Tambahkan fork pada remote, $USER adalah username GitHub andaFor example:
git remote add fork [email protected]:johndoe/php-bca.gitbranch as follows git checkout -b feature/my-new-feature origin/develop Reformat kode using the PSR-2 Coding Style Guidegit commit -am ' Menambahkan fitur A..B..C..D 'Push to the branch that has been created git push fork feature/my-new-featureMIT License
Copyright (c) 2017 odenktools
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge , publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHER WISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.