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

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.2
File Size Uploaded Provenance Actions
malipo-1.0.2.tar.gz 6.8 kB Without provenance Details for malipo-1.0.2.tar.gz

Built distribution (wheel)

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

Total release size: 12.2 kB

Release files / malipo-1.0.2.tar.gz

Download URL malipo-1.0.2.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bdf4305d6fe6dd3da6ad542498152ee0a3cfb220c76eb0fc40cb043aa82f4961
BLAKE2b-256 checksum
How to use checksums
71ec1c9c9f5e33cdcec0c3d7bc05c8111917174e11fc6a9ebc54df7f24917e2d
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.2-py3-none-any.whl

Download URL malipo-1.0.2-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c84bdbd088610ad1ac7f01f86afd32c22cd3bf4a3fecc565bc5bc93a32188b1a
BLAKE2b-256 checksum
How to use checksums
6f08cf4de71e3f84f979db79858b8d15e3caa947737d3ab3d232ec251c1e7bda
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.2

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