Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
[![build-status-image]][build-status] [![coverage-status-image]][codecov] [![pypi-version]][pypi]
A package to manage mobile payments using the MTN MoMo and Orange Money APIs
Some reasons you might want to use REST framework:
Sign up for an account
Head over to https://momodeveloper.mtn.com/ and create your account. Once created, verify your account and sign in to the developer dashboard.
Get a product subscription key
The momo developer API is segmented into different products. Like; Collections, Remittances, Disbursement, and a collections widget. Find and Subscribe to the product that your application will be using. For the case of this tutorial, we shall subscribe to the collections product. It enables us to make a remote collection of fees and bills. Once subscribed, you shall be able to get a primary subscription key and a secondary subscription key in your developer dashboard.
Installation
pip install zignpay
Create an API user
import os
from zignpay.momo import MomoApiProvisioning, MomoCollection
"""
Here we will subscribe to the product collection.
"""
subscription_key = os.environ('subscription_key') # Put the subscription key that you copied
"""
Keep in mind that your subscription key in development is different in production,
To go into production you must click on Go Live in your Dashboard
"""
The MOMO API relies heavily on unique identifying identifiers called UUIDs. Each API user you create will have a unique UUID, zignpay will generate this automatically for you.
...
momo = MomoApiProvisioning({
"subscription_key" : subscription_key,
"environment" : "DEV" # Define DEV if you are in development and PROD if you are in production
})
api_user = momo.create_api_user() # This returns the unique reference (UUID) of the created API user
if api_user: #Check if the query returns an object
api_key = momo.create_api_key() # Then generate the API key
"""
You can save these two values in a secure database, they will be necessary later.
"""
Initialize the collection class
...
collection = MomoCollection({
"api_user_id" : api_user, # The user reference created above
"api_key" : api_key, # The api key created above
"subscription_key" : subscription_key, # The subscription key for the collection product
"environment" : "DEV",
"country_code" : "CM", # our Country Codes Alpha-2
})
You will find your Country codes here.
Make a payment request
...
requestToPay = collection.request_to_pay({
"amount": 15, # Payment request amount
"from": "2376xxxxxxxx", # Example of Cameroonian number
"reference_id": "123456789",
"description": "Requested to pay" # Put your own description
})
Example query result
{
'financialTransactionId': '490639485',
'externalId': '123456789',
'amount': '15',
'currency': 'EUR',
'payer': {
'partyIdType': 'MSISDN',
'partyId': '2376xxxxxxxx'
},
'payerMessage': 'Requested to pay',
'payeeNote': 'Thank you for your payment',
'status': 'SUCCESSFUL'
}
We are currently working on improving this documentation
FAQs
A package to manage mobile payments using the MTN MoMo and Orange Money APIs
We found that zignpay demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.