HOW TO USE THE COOPERATIVE BANK KENYA API USING JAVA

cooperative bank Kenya

Installation

Requirements

  • Java 1.8 or later

Others

Usage

Initialization

Bank bank = new Bank("CONSUMER KEY", "CONSUMER_SECRET", Constants.sandbox );

Account Balance

AccountBalance response = bank.getAccountBalance("MESSAGE REFERENCE", "ACCOUNT NUMBER");

Account Full Statement

AccountFullStatement response = bank.getAccountFullStatement("MESSAGE REFERENCE", "ACCOUNT NUMBER", "STARTDATE", "ENDDATE");

Account Mini Statement

AccountMiniStatement response = bank.getAccountMiniStatement("MESSAGE REFERENCE", "ACCOUNT NUMBER");

Account Transactions

AccountTransactions response = bank.getAccountTransactions("MESSAGE REFERENCE", "ACCOUNT NUMBER", NUMBER OF TRANSACTIONS);

Account Validation

AccountValidation response = bank.validateAccount("MESSAGE REFERENCE", "ACCOUNT NUMBER" );

Exchange rate

ExchangeRate response = bank.getExchangeRate("MESSAGE REFERENCE", "FROM CURRENCY CODE", "TO CURRENCY CODE" );

Internal Funds Transfer Account ToAccount

ArrayList<DestinationIftAccountToAccount> list = new ArrayList<>();
list.add(new DestinationIftAccountToAccount("REFERENCE NUMBER", "ACCOUNT NUMBER","AMOUNT" , "TRANSACTION CURRENCY", "NARRATION"));
IftAccountToAccount response = bank.transferIftAccountToAccount("MESSAGE REFERENCE", "CALLBACK URL", new Source("ACCOUNT NUMBER", "AMOUNT", "TRANSACTION CURRENCY", "NARRATION"), list);

PesaLink To Account

ArrayList<DestinationPesaLinkToAccount> list = new ArrayList<>();
list.add(new DestinationPesaLinkToAccount("REFERENCE NUMBER", "ACCOUNT NUMBER","AMOUNT" , "TRANSACTION CURRENCY", "NARRATION"));
PesaLinkToAccount response = bank.transferFromPesaLinkToAccount("MESSAGE REFERENCE", "CALLBACK URL", new Source("ACCOUNT NUMBER", "AMOUNT", "TRANSACTION CURRENCY", "NARRATION"), list);

PesaLink To Phone

ArrayList<DestinationPesaLinkSendToPhone> list = new ArrayList<>();
list.add(new DestinationPesaLinkSendToPhone("REFERENCE NUMBER", "PHONENUMBER","AMOUNT" , "TRANSACTION CURRENCY", "NARRATION"));
PesaLinkSendToPhone response = bank.transferFromPesaLinkToPhone("MESSAGE REFERENCE", "CALLBACK URL", new Source("ACCOUNT NUMBER", "AMOUNT", "TRANSACTION CURRENCY", "NARRATION"), list);

Send To Mpesa

ArrayList<DestinationMpesa> list = new ArrayList<>();
list.add(new DestinationMpesa("REFERENCE NUMBER", "PHONENUMBER","AMOUNT" , "TRANSACTION CURRENCY", "NARRATION"));
SendToMpesa response = bank.sendToMpesa("MESSAGE REFERENCE", "CALLBACK URL", new Source("ACCOUNT NUMBER", "AMOUNT", "TRANSACTION CURRENCY", "NARRATION"), list);

Transaction Status

TransactionStatus response = bank.checkTransactionStatus("MESSAGE REFERENCE");

Going Live

Other SDKS

Help & Support

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Isaac Sichangi

Isaac Sichangi

Product Design | Software Development