mtnmomo-py
mtnmomo-py is a synchronous Python 3.10+ client for the MTN MoMo Collection, Disbursement, OAuth/CIBA, and Sandbox Provisioning APIs.
Install
pip install mtnmomo-py
Configure
Supply credentials explicitly or through environment variables. Do not commit API keys, subscription keys, or credentials.json.
from mtnmomo import MoMoClient, MoMoConfig, ProductCredentials
config = MoMoConfig(
collection=ProductCredentials(
subscription_key="collection-subscription-key",
api_user="collection-api-user",
api_key="collection-api-key",
),
disbursement=ProductCredentials(
subscription_key="disbursement-subscription-key",
api_user="disbursement-api-user",
api_key="disbursement-api-key",
),
target_environment="sandbox",
)
with MoMoClient(config) as client:
balance = client.collection.get_account_balance()
print(balance.available_balance, balance.currency)
MoMoConfig.from_env() reads:
MTN_MOMO_COLLECTION_SUBSCRIPTION_KEYMTN_MOMO_COLLECTION_API_USERMTN_MOMO_COLLECTION_API_KEYMTN_MOMO_DISBURSEMENT_SUBSCRIPTION_KEYMTN_MOMO_DISBURSEMENT_API_USERMTN_MOMO_DISBURSEMENT_API_KEYMTN_MOMO_TARGET_ENVIRONMENT(defaults tosandbox)MTN_MOMO_BASE_URL(defaults to the MTN sandbox URL)MTN_MOMO_TIMEOUT(defaults to30seconds)
Collection example
from mtnmomo import Party
reference_id = client.collection.request_to_pay(
{
"amount": "100",
"currency": "EUR",
"externalId": "order-123",
"payer": Party("MSISDN", "46733123453"),
"payerMessage": "Order 123",
"payeeNote": "Order 123",
},
callback_url="https://merchant.example/momo/callback",
)
status = client.collection.get_request_to_pay_status(reference_id)
Disbursement example
reference_id = client.disbursement.transfer(
{
"amount": "100",
"currency": "EUR",
"externalId": "payout-123",
"payee": Party("MSISDN", "46733123453"),
},
callback_url="https://merchant.example/momo/callback",
)
Testing
pip install -e .[test]
pytest
Tests are network-free by default. Safe sandbox token tests require explicit environment configuration and opt-in:
MTN_MOMO_RUN_INTEGRATION=1 pytest -m integration
State-changing sandbox operations remain mocked by default.
Publishing
Build artifacts with python -m build; inspect them to confirm secrets are absent. Publish using a user-managed PyPI token or Trusted Publishing after testing the release on TestPyPI.
Metadata
Release files for mtnmomo-py 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mtnmomo_py-0.1.0.tar.gz | 27.5 kB | With provenance | Details for mtnmomo_py-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mtnmomo_py-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for mtnmomo_py-0.1.0-py3-none-any.whl |
Total release size: 39.1 kB
Release files / mtnmomo_py-0.1.0.tar.gz
| Download URL | mtnmomo_py-0.1.0.tar.gz |
|---|---|
| Size | 27.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
42ef5f5bdda378833b13cc4f65712d5f47eeddfd9d7c305a610ee1eb420c1be9
|
|
BLAKE2b-256 checksum How to use checksums |
ed9b40f64e989f14e1e99df1550860ec885b76d6bcc97d2c278ec52e7a8d35c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 20, 2026.
Transparency logRelease files / mtnmomo_py-0.1.0-py3-none-any.whl
| Download URL | mtnmomo_py-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
76a6d5a40e41f5ab86a7f8c92fee1889bef340af441ea42f1a5de34d428ab5d6
|
|
BLAKE2b-256 checksum How to use checksums |
d03cfdaab35882e13db5a17cc0b20c116226f818ee1e04642b05ab91ba3113bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 20, 2026.
Transparency logSecurity for mtnmomo-py 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mtnmomo_py-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 20, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.