Skip to main content

This is a Monnify API wrapper

Project description

MonnifyEase Library


Python Versions

MonnifyEase simplifies interacting with the Monnify payment gateway in Python. It offers wrappers for various functionalities, streamlining payment processing for your projects.

Monnify (owned by Moniepoint) is a Nigerian payment gateway that allows businesses to accept payments easily and securely.

📝: Read more on Monnify api documentation: Monnify API DOCUMENTATION

📝: Read more on monnifyease api documentation: MonnifyEase DOCUMENTATION

Getting Started

You should create a Monnify account to generate:

  1. Monnify Secret Key
  2. Monnify Api Key
  3. Monnify Merchant Code
  4. Monnify Base URL

You can see this in the developer page >> API keys and Contracts section.

⚠️: Warning: Do not expose your secret key, api key, merchant code, base url or commit your any to git, or use them in client-side code.

💡: Take Note: The Monnify SDK is to be used from your front-end when integrating using Monnify.

✅: Good: Set your secret key, api key, base url and merchant code in environment variables as seen:

  1. MONNIFY_SECRET_KEY=your-secret-key
  2. MONNIFY_API_KEY=your-api-key
  3. MONNIFY_SECRET_KEY=your-secret-key
  4. MONNIFY_MERCHANT_CODE=your-merchant-code

Create a Virtual Environment

  1. For Windows:

    • Create virtual environment

          py -m venv <environment_name>
      
    • Activate the virtual environment

          <environment_name>\Scripts\activate
      
  2. For Unix/macOS

    • Create virtual environment

          python3 -m venv <environment_name>
      
    • Activate the virtual environment

          <environment_name>/bin/activate
      

Install monnifyease library:

  • Install monnifyease using pip.

pip install monnifyease

  • Install monnifyease using pipx.

pipx install monnifyease

  • Install monnifyease using poetry.

poetry add monnifyease

If you want to download the sdist packages directly:

Download the wheel distribution file and install using pip

pip install monnifyease-0.i.0-py3-none-any.whl

Download the source distribution file, and install using pip

pip install monnifyease-0.i.0.tar.gz

To get a development version of monnifyease

Clone from the dev branch GitHub repository, unzip and install:

git clone -b dev https://github.com/cla-bit/MonnifyEase.git

cd monnifyease

pip install monnifyease


API usage


Making a Transaction [Synchronous]

If after setting your secret key in environment variables, for a synchronous transaction process all you need to do is use the transaction API to make a transaction.

To create a transaction or initialize a transaction:

  • import the Monnify API wrapper.
from monnifyease import Monnify, Currency, MERCHANT_CODE

client = Monnify()

create_transaction = client.transactions.initialize_transaction(
    amount=1000.00,
    customer_name="Test Customer",
    customer_email="test@gmal.com",
    payment_reference="test123prod",
    payment_description="Testing payment",
    currency=Currency.NGN.value,
    merchant_contract_code=MERCHANT_CODE,
   # add other parameters here
)

print(f"Transaction Created: {create_transaction}")

✅: Good: You can check your Monnify account, go to the Transaction page, and you will see the transaction just created.

Other Tools

Similar to calling the Monnify, you can also call other tools to make your work easy. For example:

  • Currency Type

from monnifyease import Currency

val1 = Currency.NGN.value
print(val1)

"NGN"

See documentation for more: https://monnifyease.readthedocs.io/en/latest/

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

monnifyease-0.2.0.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

monnifyease-0.2.0-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file monnifyease-0.2.0.tar.gz.

File metadata

  • Download URL: monnifyease-0.2.0.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for monnifyease-0.2.0.tar.gz
Algorithm Hash digest
SHA256 82045fb9aa32566d4730937c27562c0e7811410d6ea11b7f6eebb0eef019ba34
MD5 a6cf3d969079e3c524dc4d11fa7106ba
BLAKE2b-256 31f9cad53a22f9fc8eeb3e136810a5ea163c4006d656dcb86381cfcf2ea5884b

See more details on using hashes here.

File details

Details for the file monnifyease-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: monnifyease-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for monnifyease-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ca7085e2993c71ef7a8e1b348878025e06c86e25b31eda7180190506a4646a6
MD5 46567cb2c5c2704ce34ae5b96e5e3940
BLAKE2b-256 4f3d61a83ef6f56c7d817ea5ca084c36f16c4c04c3a3370411421e930008f923

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