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.0.3.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

pytekcoopbank-0.0.3-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytekcoopbank-0.0.3.tar.gz
  • Upload date:
  • Size: 22.5 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.0.3.tar.gz
Algorithm Hash digest
SHA256 a93a3603007c4f616223da53f11280d690136f15b0c985ccab0989b28dc6411b
MD5 f32cc3bb6ef0129d99b1f218fbc7df8c
BLAKE2b-256 72e52f7ee6106dc355d088b98aff4c2cc4f194822ae6af6311be1aaf54b858f0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytekcoopbank-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 22.1 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.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 aa0cb38c860f00ada73153d8cecf775937dea3813672db689ca7aeaf3e810b27
MD5 6784df2f74522a53c5fa8c930f51ece6
BLAKE2b-256 fe28b94c218fa059803fbb7e2a988f0e3d0b3d5746efddaa31631aec439a63f6

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