Moncashify SDK

Moncashify is a python sdk to process requests to the official MonCash API. It is maintained by the Code9Haiti Developer Community, you should come join us here or contact us.

Getting Started

If you’re new to Moncashify you can get started by following the tutorial Implement Moncashify SDK In Your Python Projects.

Once the package is installed, it is easy to import the package into your project.

import moncashify

Use the API() method to initialize the process.

moncashify.API(client_id, secret_key, debug)

client_id and secret_key can be found in your Moncash administration. The debugging setting (debug) will define whether you are in production or not. The default is True, which means you are in development.

moncash = moncashify.API(client_id, secret_key, debug=True)

Make a payment

To receive payment from a customer, you must have the unique identifier for the order and the amount to be invoiced.

moncash = moncashify.API(client_id, secret_key)
payment = moncash.payment(unique_order_id, amount_of_money)

The unique identifier is up to you, make sure you never send duplicate IDs to the API, to avoid duplicates. The returned value is an object with the following attribute: redirect_url. This attribute is the generated URL that your customer will use to pay for the order.

Use instance.get_response() to have all the details related to the transaction request whether it’s successful or not.

Use instance.get_redirect_url() to have the payment url.

Retrieve transaction details

To retrieve the details of a successful transaction, this process can be done with the order_id provided by you or the transaction_id generated by the MonCash API itself.

moncash = moncashify.API(client_id, secret_key)
moncash.transaction_details(order_id_or_transaction_id=order_id_or_transaction_id)

If you use transaction_details method, you will need to provide the parameter key order_id or transaction_id and its value.

Using order_id

To get the transaction details with the order_id, call the method transaction_details_by_order_id() with the order_id as parameter.

Using transaction_id

To get the transaction details with the transaction_id, call the method transaction_details_by_transaction_id() with the transaction_id as parameter.

Change credentials

There is no need to re-instantiate a moncashify object to define a new client_id or secret_key. The set_credentials(client_id, secret_key) method will replace the old credentials with the new ones provided as parameters.

1
2
3
4
5
6
7
moncash = moncashify.API(‘A12’,’POAK32’)
print(moncash)
# Moncashify Object - Client ID A12

moncash.set_credentials(‘0012’,’HAITI3923’)
print(moncash)
# Moncashify Object - Client ID 0012

In production

To start using production credentials, initialize the API by overriding the third API parameter debug.

moncash = moncashify.API(client_id, secret_key, debug=False)

Using the instance

change the value of the debug can be done with the instance.

moncash = moncashify.API(client_id, secret_key)
moncash.debug = False

Licence

Copyright (c) 2021 Code9Haiti Software Development

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Donation

If you are having issues, please let me know at: lemayzeur@code9haiti.com

This project relies on your generous donations. If you are using Moncashify to create commercial products, please consider becoming our backer or our sponsor to ensure the sdk’s future.

  • Paypal:

  • Moncash:

    Phone: +(509) 38747485

    Name: Lub-Lorry Lamysère

Installation

Moncashify is distributed as a Python package through PyPI and it can be installed with tools like pip:

pip install moncashify

Support

If you are having issues, please let me know at: lemayzeur@code9haiti.com

This project relies on your generous donations. If you are using Moncashify to create commercial products, please consider becoming our backer or our sponsor to ensure the sdk’s future by clicking here