Skip to main content

MainMoney Python SDK

Python client for the MainMoney aggregator merchant API. Install this package in your Python application (Django, FastAPI, Flask, or scripts).

The JS/TS frontend SDK can be used in the browser only if this SDK (or the PHP or Node SDK) runs on your server. Never put merchant API keys in frontend code.

Requirements

  • Python 3.11 or later (3.13 or 3.14 recommended)
  • A merchant application on MM Aggregator

Install

With uv (recommended):

uv add mm-aggr-sdk

With pip:

pip install mm-aggr-sdk

With Poetry:

poetry add mm-aggr-sdk

Until the package is on PyPI, install from GitHub:

pip install git+https://github.com/MainMoney-Inc/mm_aggr_python_sdk.git

Quick start

import os

from mm_aggr import Client

client = Client(
    client_id=os.environ["MM_CLIENT_ID"],
    secret=os.environ["MM_API_SECRET"],
    test=True,  # https://testaggregator.mainmoney.net — omit for production
)

deposit = client.deposits.create(
    {
        "provider_code": "VODACOM_MPESA_COD",
        "reference": "ORDER-123",
        "amount": "100.00",
        "currency": "USD",
        "customer_phone": "243820000000",
    },
    idempotency_key="ORDER-123",
)

Defaults: production https://aggregator.mainmoney.net/api/v1/, test https://testaggregator.mainmoney.net/api/v1/. Pass base_uri only to override. Configure credentials from your environment. Merchant API docs: /api/v1/docs/merchants/ on the aggregator host.

Exchange client_id and secret for a Bearer access token is handled by the SDK. There is no X-API-KEY header. Reuse the same reference and optional Idempotency-Key when retrying a create. Amounts are decimal strings; do not mix currencies.

Verify inbound webhooks with client.webhooks.verify(raw_body, signature, secret).

Do not send merchant API keys to the browser.

License

Copyright (c) 2026 MainMoney SARL. Licensed under the MIT License. See LICENSE.

Examples

Runnable mini-shops live in examples/. Each folder has its own README (Django REST Framework, FastAPI, Flask). Pair them with a JS/TS frontend example.

Want to contribute? See CONTRIBUTING.md.

Metadata

Release files for mm-aggr-sdk 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mm-aggr-sdk 0.1.1
File Size Uploaded Provenance Actions
mm_aggr_sdk-0.1.1.tar.gz 223.4 kB With provenance Details for mm_aggr_sdk-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mm-aggr-sdk 0.1.1
File Interpreter ABI Platform Actions
mm_aggr_sdk-0.1.1-py3-none-any.whl Python 3 none any Details for mm_aggr_sdk-0.1.1-py3-none-any.whl

Total release size: 241.0 kB

Release files / mm_aggr_sdk-0.1.1.tar.gz

Download URL mm_aggr_sdk-0.1.1.tar.gz
Size 223.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b03e2ebc7d03e30d0a3eed66ddda1cdb7ce933d9e93e4f1fc8f4dd39d0808bb0
BLAKE2b-256 checksum
How to use checksums
7ab47c8b0301b9ef09ce6b8eb6d197b05eb880eec3679d0a4d0d82b969b1b6bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Oct 11, 2026.

Transparency log

Release files / mm_aggr_sdk-0.1.1-py3-none-any.whl

Download URL mm_aggr_sdk-0.1.1-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36c02e20473a3483c5c40e49ba5b9d77a8a49387196a4763d0ecdcca77e20bf2
BLAKE2b-256 checksum
How to use checksums
fadecc6daa5097162c96532ac516a53ab62536e528e825d80cdbae9f47696d77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Oct 11, 2026.

Transparency log

Security for mm-aggr-sdk 0.1.1

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.

Select from 2 files

Attestation for mm_aggr_sdk-0.1.1.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 Oct 11, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page