Skip to main content

Malipo Python SDK

The official Python library for the Malipo Payment Gateway. Securely accept Mobile Money payments (Vodacom MPesa, Orange Money, Airtel Money) in the DRC.

Installation

pip install malipo

Quick Start

from malipo import Malipo

malipo = Malipo(api_key='sk_test_your_api_key')

# Create a charge
try:
    charge = malipo.charges.create({
        "amount": 10,
        "currency": "USD",
        "phone": "243810000000",
        "network": "VODACOM_MPESA",
        "description": "Order #123"
    }, idempotency_key='unique_order_id_123')

    print(f"Charge initiated: {charge['id']}")
    print(f"Status: {charge['status']}") # 'pending'
except Exception as e:
    print(f"Charge failed: {e}")

Features

🔐 Idempotency

Protect against duplicate charges by providing an idempotency_key in the options.

🔄 Environment Detection

The SDK automatically switches between sandbox and live environments based on your API key prefix (sk_test_ vs sk_live_).

📊 Balance Check

Check your available and pending balances for your current environment.

balance = malipo.balance.retrieve()
print(f"Available USD: {balance['available'][0]['amount']}")

Webhooks

from flask import Flask, request
from malipo import Malipo

app = Flask(__name__)
malipo = Malipo(api_key='...')

@app.route('/webhooks/malipo', methods=['POST'])
def handle_webhook():
    signature = request.headers.get('X-Webhook-Signature')
    payload = request.get_data(as_text=True)
    
    try:
        event = malipo.webhooks.construct_event(
            payload=payload,
            signature=signature,
            secret='whsec_your_secret'
        )
        
        if event['type'] == 'charge.succeeded':
            charge = event['data']['object']
            print(f"Payment successful: {charge['id']}")
            
        return "OK", 200
    except Exception as e:
        return str(e), 400

License

MIT

Metadata

Release files for malipo 1.0.3

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

Source distribution (sdist)

Source distribution for malipo 1.0.3
File Size Uploaded Provenance Actions
malipo-1.0.3.tar.gz 7.0 kB Without provenance Details for malipo-1.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for malipo 1.0.3
File Interpreter ABI Platform Actions
malipo-1.0.3-py3-none-any.whl Python 3 none any Details for malipo-1.0.3-py3-none-any.whl

Total release size: 12.4 kB

Release files / malipo-1.0.3.tar.gz

Download URL malipo-1.0.3.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a1666d6aae35fc87d9c2489c1bbc7e6a35dc8ced0592d1bd08ebcfc7a1f6a876
BLAKE2b-256 checksum
How to use checksums
b1ffc1e71099830cca6b436d53bec6efb23b4ac105abd71a2beb7efaa8dbfb85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / malipo-1.0.3-py3-none-any.whl

Download URL malipo-1.0.3-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b61ba15cb11594248ed35a8c05f4aba16e99534c5cd85dea6bf2fd8753732554
BLAKE2b-256 checksum
How to use checksums
65cb9b3e4b21667df02c3a70b40a362812083235bbe767c2a95878cd935801e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for malipo 1.0.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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