Skip to main content

"Unofficial Co-operative Bank of Kenya API Python SDK."

Project description

Build Status Build status Documentation Status License: GPLv3 Organization Views PRs Welcome GitHub pull-requests Language

pytekcoopbank

TralahTek TralahM TralahM

Co-operative Bank of Kenya Python SDK

Intuitive Python SDK for the Co-operative Bank of Kenya developer APIs.

Pre-requisites

Create an application

Create or login to your account at https://developer.co-opbank.co.ke:9443/store/

On the left panel, you can see a list of menus. Click on Applications to access the list of available applications in which case you can choose to use the default ones or create your own.

Subscribe to API(s)

  • Select the application or create your own application using steps described earlier.
  • Click “Subscribe”. A pop up message appears as shown:

Generate Keys

  • Click on “Applications” on the left panel.
  • Choose the application for which you want to generate keys
  • Choose the appropriate environment from the tabs(production or sandbox ).
  • Specify Callback URL and then click “Generate keys”. Leave other fields have default values;

Installation

Via PIP on pypi

# In terminal do:
$ pip install pytekcoopbank

Building from Source for Developers

$ git clone https://github.com/TralahM/pytekcoopbank.git
$ cd pytekcoopbank
$ python setup.py install

Documentation

Documentation

Setup

import tekcoopbank

config=dict(
        env                 = "sandbox",
        consumerKey         = "ss0sD2ANhjvhx_rHU0a6Xf8ROdYa",
        consumerSecret      = "zOfReXCIwn1TfnEYJJJGNP6l3Tka",
        accountNumber       = "54321987654321",
        bankCode            = "011",
        branchCode          = "00011001",
        callbackURL         = "/coop/callback",
        transactionCurrency = "KES",
)

COOP=tekcoopbank.setup_coop(config)

Usage

Check Account Balance

balance=COOP.balance.send(messageReference,accountNumber=None,callback=None)

Check Account Transactions

transactions=COOP.transactions.send(messageReference,accountNumber,NoOfTransactions=2,callback=None)

Account MiniStatement

mini_statement=COOP.mini_statement.send(messageReference,callback=None)

Account FullStatement

full_statement=COOP.full_statement.send(messageReference,callback=None)

Account Validation

validation=COOP.validation.send(messageReference,accountNumber,callback=None)

Get Exchange Rates

exchange_rate=COOP.exchange_rate.send(messageReference,
    accountNumber,
    fromCurrencyCode="KES",
    toCurrencyCode="USD",
    callback=None)

IFT Account to Account Transfer

ift_to_account=COOP.ift_to_account.send(messageReference,
    accountNumber,
    amount,
    transactionCurrency="KES",
    narration="Payment",
    destinations=[{},],
    callback=None)

PesaLink Account to Account Transfer

pesalink_to_account=COOP.pesalink_to_account.send(messageReference,
    accountNumber,
    amount,
    transactionCurrency="KES",
    narration="Payment",
    destinations=[{},],
    callback=None)

PesaLink Account to Phone Transfer

pesalink_to_account=COOP.pesalink_to_account.send(messageReference,
    phoneNumber,
    amount,
    transactionCurrency="KES",
    narration="Payment",
    destinations=[{},],
    callback=None)

Send to Mpesa

pesalink_to_account=COOP.pesalink_to_account.send(messageReference,
    mobileNumber,
    amount,
    transactionCurrency="KES",
    narration="Payment",
    destinations=[{},],
    callback=None)

Transaction Status

transaction_status=COOP.transaction_status.send(messageReference,callback=None)

Test Cases

As a developer, the test cases will be available to you for download as you are creating the sandbox app.

The test cases are in place to ensure that you have well understood the API structure for requests and responses for our different APIs. These test cases are in an excel spreadsheet that you should fill in with the results from each of the test scenarios that you want to consume.

As the Test cases will cover all the APIs available, you will only be required to carry out the test cases for the APIs you had initially selected.

Go - Live

Once you have already tried out the APIs on our platform and have tested these against our test cases provided, you can make a formal request to go to production.

You will need to have the test cases duly filled, then send an email request, together with these filled in test cases, to our support team who will guide you on the next steps to enable you to get to production.

Send the email request and the test cases to digitalbanking@co-opbank.co.ke

Contributing

See the Contributing File

See the Pull Request File

Support

LICENCE

Read the license here

Self-Promotion

TralahM TralahM

Blog

TralahTek

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytekcoopbank-0.1.0.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

pytekcoopbank-0.1.0-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file pytekcoopbank-0.1.0.tar.gz.

File metadata

  • Download URL: pytekcoopbank-0.1.0.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for pytekcoopbank-0.1.0.tar.gz
Algorithm Hash digest
SHA256 764396bd444503bf41ccce7aed6a975e1868e8daafccb0567d3cfb880eed7ecb
MD5 8598994a1e88c5f79869a72fe10d8b01
BLAKE2b-256 5553f46671b03485ec1912acd41ef76d7542e2deb73876509d9ebcd78d6c7914

See more details on using hashes here.

File details

Details for the file pytekcoopbank-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pytekcoopbank-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.5

File hashes

Hashes for pytekcoopbank-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d5cf5c3a415803af81176b55938a33190ed44839ccb8cf407e73daef57ce10ca
MD5 927baeb301865224f95326f87300cf82
BLAKE2b-256 7658e28ce1c659cdeca86d4d91f1200152d046529d094c2ada7da730f3aa771d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page