Package: ugmobilemoney
UG MOBILE MONEYUG Mobile Money is a python library for making mobile money transactions in Uganda. It currently supports MTN MOMO.UG Mobile Money provides a simple interface for making mobile money transactions in a way that is similar to what the official MTN Mobile Money API provides but in a more pythonic and simple way. This makes it easy for beginners to get started and also for experienced developers who have been using the official API shift.The library also handles other underlying functions like encryption, Authorization and regenerating access tokens. This makes it easy for developers to focus on the business logic of their applications and not worry about the underlying details.The library utitlizes the Official MTN Mobile Money API. The API is documentedhere.InstallationUse the package managerpipto install UG Mobile Money.pipinstallugmobilemoneyAfter installing it you can now import the package in your project.frommobile_money.momoimportCollection,DisbursmentUsageThis library is currently in development and only supports MTN MOMO. It supports the following operations:CollectionRequest to payDisbursmentTransferNote:You need to have an account with MTN MOMO and have your API user ID and API key. You can get these from theMTN MOMO Developer Portal. If your in sandbox environment, we provide utils for creation of API user ID and API key.CollectionThe UG Mobile Money library provides aCollectionclass that can be used to carry out operations or call the MOMO APIs provided under the collection Products.You access it from themobile_money.momomodule.frommobile_money.momoimportCollectioncollection=Collection(subscription_key=SUBSCRIPTION_KEY,api_user=API_USER,api_key=API_KEY,callback_url="http://mydomain.com/webhooks/mtn/",production=False,)Request to PayRequest to pay is a service that allows a merchant to receive payments on from a customer. This is typically used when a customer is paying for goods or services. Thecollect()method is used to initiate a request to pay transaction.frommobile_money.momoimportCollectionfrommobile_moneyimportgenerate_uuidcollection=Collection(subscription_key=SUBSCRIPTION_KEY,api_user=API_USER,api_key=API_KEY,callback_url="http://mydomain.com/webhooks/mtn/",production=False,)transaction_reference=generate_uuid()# Request to payresponse=COLLECTION.collect(amount="100",phone_number="256772123456",currency="UGX",external_id="external id",reference_id=transaction_reference,payee_note="test",payer_message="test",)print(response)# >>> <Response [202 Accepted]>DisbursmentThe UG Mobile Money library provides aDisbursmentclass that can be used to carry out operations or call the MOMO APIs provided under the Disbursment Products.You access it from themobile_money.momomodule.frommobile_money.momoimportDisbursmentDISBURSEMENT=Disbursment(subscription_key=SUBSCRIPTION_KEY,api_user=API_USER,api_key=API_KEY,callback_url="http://mydomain.com/webhooks/mtn/",production=False,)TransferTransfer is a service that allows a merchant to transfer money from their account to a customer's account. This is typically used when a customer is receiving money for goods or services. Thetransfer()method is used to initiate a transfer transaction.frommobile_money.momoimportDisbursmentfrommobile_moneyimportgenerate_uuidDISBURSEMENT=Disbursment(subscription_key=SUBSCRIPTION_KEY,api_user=API_USER,api_key=API_KEY,callback_url="http://mydomain.com/webhooks/mtn/",production=False,)transaction_reference=generate_uuid()# Transferresponse=DISBURSEMENT.transfer(amount="100",phone_number="256772123456",currency="UGX",external_id="external id",reference_id=transaction_reference,payee_note="test",payer_message="test",)print(response)# >>> <Response [202 Accepted]>ContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.LicenseMIT License (MIT). Please seeLicense Filefor more information.