Code Monkey home page Code Monkey logo

mono-client's Introduction

The Unofficial python wrapper around mono.co APIs

Mono helps businesses to access high-quality financial data and direct bank payments, with this package you can have a pythonic access to mono's APIs.

Getting Started

Installation

    pip install mono-client

Setup, Inialize the package using your mono test or live secret_key

    from mono_client import Client
    client = Client(secret_key='secret')

Usage

Now, lets create an account holder, then generate a bank account for our user and transfer funds.

  • Create an account holder on mono
    res = client.create_holder(
        bvn='12345',
        city='Abuja',
        state='Abuja',
        last_name='Doe',
        first_name='Jane',
        phone='+2347000000000',
        email='[email protected]',
        address='Abuja, Nigeria',
    )

    # example response

    {
        "status": "success",
        "message": "Account holder created successfully",
        "data": {
            "id": "61a73645c2d313658ce82d44"
        }
    }

We have holder, now lets generate a bank account for our user.

  • Create a bank account

pass the parameter virtual=True to make a virtual bank account.

    res = client.create_account(holder_id='61a73645c2d313658ce82d44', virtual=True)

    # example response
    {
        "status": "successful",
        "message": "Virtual account generation is processing",
        "data": {
            "id": "62decea1063a19fcba1234"
        }
    }

At this point you should be able to transfer money to this account (if you used live credentials in the setup).

Transfer funds from one user account to another (internal)

  • Internal Transfer
    res = client.transfer_internal(
        amount='1000',
        reference='reference',
        narration='funds transfer',
        to_account_id='62decea1063a19fcba1234',
        from_account_id='54decea1063a19fcba2434',
        meta={"my_reference": "12345"}, # optional dict. e.g {"my_reference": "12345"}
    )

    # example response
    {
        "status": "successful",
        "message": "Transfer is processing",
        "data": {
            "id": "62f0c405dcf59e51e408daf9"
        }
    }

Transfer funds from user account to an external bank account

  • Transfer
    res = client.transfer(
        amount='1000',
        narration='narration',
        reference='reference',
        from_account_id='62decea1063a19fcba1234',
        to_bank_code='211', # bank code, e.g Stanbic IBTC is 211
        to_account_number='0000000000', # Account number for the stated bank_code
        meta={"my_reference": "12345"}, # optional dict. e.g {"my_reference": "12345"}
    )

    # example response
    {
        "status": "successful",
        "message": "Transfer is processing",
        "data": {
            "id": "62f0c405dcf59e51e408daf9"
        }
    }

Retrieve a bank account

  • Get Account detail
    res = client.get_account(account_id=account_id, virtual=True)

Get list of banks

  • Retrieve banks
    res = client.get_banks()

    # example response
    {
        "status": "successful",
        "data": [
            {
                "name": "Access Bank",
                "code": "044"
            },
            {
                "name": "Citi Bank",
                "code": "023"
            }
            ...
            ...
        ]
    }

Docs

Learn how to use each function
    help(client.transfer)
View all available functions
    dir(client)

Authors

Abdulrasheed Ibrahim @CodePharaoh

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.