Changelog¶
All notable changes to the Py MoMo SDK (py-momo-sdk) project will be documented in this file.
1.3.3 - 2026-11-28¶
Security¶
- Attached
Wave-Signatureheaders across all 10 WaveGETandPOSTendpoints whenWaveConfig.signing_secretis configured, and refreshedWave-Signaturetimestamps per attempt across transient retries viaheader_signerinHttpClientandAsyncHttpClient(#161). - Added Base64 HMAC digest verification (
encoding="base64", auto-selected whenprovider="airtel") acrossverify_raw_webhook_request(),create_asgi_webhook_verifier(),verify_django_webhook_request(), andpy-momo-sdk webhook verify --encoding(#165). - Redacted
authorization_codeandencryption_keyin exceptionresponse_bodydictionaries, and redactedclient_idinAirtelConfig.__repr__,AirtelAuth.__repr__, andAsyncAirtelAuth.__repr__(#169).
Fixed¶
- Adapted cross-provider
reference_idvalues inPaymentRouterandAsyncPaymentRouter(<=30chars for Orangeorder_id, deterministic RFC 4122 UUID v4 for MTN MoMo,16to50lowercase[a-z0-9_-]chars for Paystack transfers,<=64chars for Airtel Money) while preserving caller merchant references inexternal_id, and compacted 36-char UUIDs inOrangeMoneyProvider(#159). - Auto-populated
client_referenceinWaveProviderwith fallback reconciliation viasearch_checkout_sessions()andsearch_payouts(), and wiredFlutterwaveProvider.get_status(..., kind="disbursement")toget_transfer_by_reference()for non-numeric merchant references (#160). - Normalized Kenyan local MSISDNs (
07...,01...,7...,1...,2540...) to254XXXXXXXXXand validatedRemarks(2to100chars) andOccasion(0to100chars) inMpesaClientandAsyncMpesaClient(#162). - Checked Airtel HTTP
200error envelopes onget_payment_status()andget_transfer_status()whendata.transactionis absent, enforced zero-decimal currency validation across Airtel collections and disbursements, and addedGHS,CDF,USD,MGA, andSCRto_AIRTEL_CAPABILITIES.currencies(#163). - Enforced integer amounts for
GNFandMGAin Orange Money, exportedOrangePaymentContextStore, and addedset_notif_token()andget_notif_token()for multi-worker webhook verification (#164). - Enabled UTF-8 JSON delivery notifications in MTN
send_delivery_notification()(attaching the optional HTTP header only when printable ASCII), validatedParty.party_id_typeagainstMSISDN,EMAIL, andPARTY_CODE, and addedUSDto_MTN_CAPABILITIES.currencies(#166). - Added
do_DELETE, Orangenotif_tokentracking, and deterministic mock routes for all v1.3.2 endpoints across MTN, Airtel, Wave, M-Pesa, Paystack, and Flutterwave inmock_server.py(#167). - Enforced
_ZERO_DECIMAL_CURRENCIESin Paystack_to_minor_units()while preserving* 100integer scaling, and addedtests/unit/test_architecture_invariants.pyto enforce cross-provider horizontal rules on every CI run (#169).
Documentation¶
- Updated
docs/providers.md,docs/collection.md,docs/airtel.md,docs/webhooks.md, anddocs/cli.mdwith runnable examples for Paystack transfer recipients and valid16to50char transfer references, Wave request signing and search, M-Pesa MSISDN normalization and callback parsers, Flutterwave reference reconciliation,OrangePaymentContextStore, MTN PreApprovals and UTF-8 delivery notifications, and Base64 webhook verification (#168).
1.3.2 - 2026-11-27¶
Security¶
- Rejected unknown keys, malformed hex digests, whitespace, and excess parts in timestamped webhook signatures (
WebhookHandler.verify_timestamped_hmac_signature), and passed a canonicalt=<ts>,v1=<hex>key toreplay_checkto prevent replay-deduplication bypasses (#120). - Blocked
.localhostsubdomains, IPv4-mapped IPv6 loopback, NAT64/6to4/Teredo/SIIT/deprecated IPv4-compatible/discard IPv6 prefixes, RFC 5737 TEST-NET-2/3, and RFC 3068 6to4 relay ranges in SSRF URL validation (#121). - Propagated
allow_localhostinHttpClient/AsyncHttpClient, enforcedallow_localhost=(environment == "sandbox")inOrangeMoneyConfig, and addedenvironmentand live-key guards (sk_live_,FLWSECK-,_prod_) inPaystackConfig,FlutterwaveConfig, andWaveConfig(#122). - Validated
client_id,client_secret,base_url, andmax_response_bytesdirectly inAirtelAuthandAsyncAirtelAuth, and propagatedallow_localhostfromAirtelClient/AsyncAirtelClient(#123). - Normalized
_and-before matching sensitive keys inpy_momo_sdk/exceptions.py, redacting camelCase and kebab-case credentials alongsidepay_token,notif_token,signing_secret,verif_hash, andprivate_key(#124). - Protected CLI
sandbox provision --output-filewrites against symlink attacks and world-readable races usingos.lstat,os.O_NOFOLLOW,os.fstat, andos.fchmod(fd, 0o600)(#125). - Replaced string concatenation with structured
(namespace, product)tuple keys inTokenCacheto prevent cache-key collisions (#126). - Normalized trailing-dot FQDNs and blocked both
proxy.momoapi.mtn.comandmomoapi.momo.africainSandboxProvisionerandAsyncSandboxProvisioner(#127). - Enforced cumulative read deadlines with HTTP
408responses against slow-drip body DoS inmock_server.py(#128). - Added optional outbound
Wave-Signaturerequest signing (WaveConfig.signing_secret) over exact raw bytes for WavePOST /v1/payoutandPOST /v1/payout/{id}/reverse, and aligned Wave's defaultmax_future_skew_secondsinverify_webhookto30seconds (#136). - Enforced zero-decimal currency precision validation (
validate_amount(..., currency=...)) inPaymentRequest,DisbursementRequest,WaveClient/AsyncWaveClient, andFlutterwaveClient/AsyncFlutterwaveClient(#137).
Added¶
- MTN MoMo: Exported
ONE_API_PRODUCTION_BASE_URL(https://momoapi.momo.africa), addedget_user_info_with_consent()(/collection/oauth2/v1_0/userinfo),send_delivery_notification(), and PreApproval endpoints (create_preapproval,get_preapproval_status,cancel_preapproval,PreApprovalRequest,PreApprovalResult) with sync/async parity (#130). - Airtel Money: Added
collection.refund(),client.get_user_info(),client.verify_webhook()(Base64 HMAC-SHA256 viaencoding="base64"onWebhookHandler.verify_hmac_signature), andsign_airtel_payload(), and enabledsupports_webhook_hmac=True(#131). - Safaricom M-Pesa (Daraja): Added
encrypt_mpesa_security_credential(),query_transaction_status(),query_account_balance(),reverse_transaction(),parse_mpesa_stk_callback(), andparse_mpesa_b2c_callback()with sync/async parity (#132). - Orange Money: Persisted
notif_tokenperpay_tokenand added constant-timeverify_webhook_notification()(#133). - Paystack: Added
channelssupport oninitialize_transaction,create_transfer_recipient(POST /transferrecipient),list_banks(GET /bank),charge_mobile_money(POST /charge), andcreate_refund(POST /refund) with sync/async parity (#134). - Flutterwave: Added
beneficiary_name,destination_branch_code,debit_currency, andmetaoncreate_transfer, pluscharge_mobile_money(POST /v3/charges?type=mobile_money_*/mpesa),verify_transaction_by_id,refund_transaction, andget_transfer_by_referencewith sync/async parity (#135). - Wave: Added
restrict_payer_mobileoncreate_checkout_session,refund_checkout_session,expire_checkout_session,reverse_payout,search_checkout_sessions, andsearch_payoutswith sync/async parity (#136).
Fixed¶
- Disabled automatic transient retries (
idempotent=False) on PaystackPOST /transferandPOST /transaction/initialize(#129). - Corrected MTN CIBA OAuth2 token endpoint path to
/collection/oauth2/token/(#130). - Switched Airtel balance queries to
GET /standard/v1/users/balancewith flat and nested payload parsing and includedcountry/currencyin Airtel disbursementtransactionpayloads (#131). - Mapped Daraja HTTP
500errorCode == "500.001.1001"to pending instk_queryand enforced the 13-characterTransactionDesclimit (#132). - Switched Orange Money default
order_idto a compact 30-character token, enforced Orange length limits (order_id <= 30,reference <= 30, callback URLs<= 120), and mappedtxnidtoPaymentResult.provider_transaction_id(#133). - Enforced Paystack's
^[a-z0-9_-]{16,50}$transfer reference format prior toPOST /transfer(#134). - Serialized Flutterwave v3 transfer, charge, and refund amounts as JSON numbers (
int/float) instead of strings (#135). - Aligned
MTN_CAPABILITIES(RWF,NGN),ORANGE_CAPABILITIES(CDF,GNF,LRD,MGA,SLE,BWP,USD), andWAVE_CAPABILITIES(GMD) currencies with carrier detection (#138).
1.3.1 - 2026-11-24¶
Fixed¶
- Preserved the payment
reference_id(both caller-supplied and auto-generated) on every failed request across all 7 payment rails (MTN MoMo, Airtel Money, Wave, Safaricom M-Pesa, Paystack, Flutterwave, and Orange Money) in both synchronous and asynchronous clients, including HTTP4xx/5xxerrors, timeouts, connection errors, response-size rejections, OAuth2 token acquisition/refresh failures, and JSON/schema parsing errors. - Surfaced clear, structured upstream failure diagnostics on
PyMomoSDKErrorand all subclasses viareference_id,status_code,error_code,reason, secret-redactedresponse_body,provider, andattempted_referencesacross all 7 gateway error schemas (including HTTP422validation errors mapped toBadRequestError, Airtel HTTP200status.result_coderejections, sanitized plain-text bodies with HTML suppression, and safe transport exception subtypes such as(ReadTimeout)and(ConnectError)without chaining raw request headers). - Attached
attempted_referencesonPaymentRouterandAsyncPaymentRouterfailover exhaustion, addedreference_idsupport towait_for_settlement()andasync_wait_for_settlement(), and included(reference_id: ...)in CLI error output.
1.3.0 - 2026-11-23¶
Added¶
- Exported all 13 MTN environment constants (
SANDBOX,MTN_UGANDA,MTN_GHANA,MTN_RWANDA,MTN_CONGO,MTN_IVORY_COAST,MTN_CAMEROON,MTN_ZAMBIA,MTN_BENIN,MTN_SWAZILAND,MTN_GUINEA_CONAKRY,MTN_SOUTH_AFRICA,MTN_LIBERIA),detect_carrier_from_msisdn,wait_for_settlement,async_wait_for_settlement, andverify_static_token_webhook_requestfrom top-levelpy_momo_sdk. - Added optional packaging extras in
pyproject.toml:[cli],[airtel],[fastapi],[django], and[all], PEP 639 SPDX license metadata, and build provenance attestation + SHA-256 checksums in release publishing. - Added
OrangePaymentContextStorepluggable store support and statelessget_status(..., order_id, amount, currency)onOrangeMoneyProvider/AsyncOrangeMoneyProvider,PaymentRouter/AsyncPaymentRouterthreading.RLocksafety, failover reconciliation (prior_failed_attempts), 18-market pan-African carrier prefix mapping withcustom_carrier_prefixes, and context-managed lifecycleclose()/aclose()across all providers and routers. - Expanded CLI with
disbursement transfer/status,remittance transfer/status,airtel encrypt-pin/balance,webhook verify,--*-file/ stdin secret loading,--output-file(0600),--redact-secret, and resilience flags (--timeout,--max-retries,--retry-backoff); expandedmock_serverwith IPv6::1, chunked decoding, bounded concurrency semaphore, MTN409 Conflict, and multi-provider routes.
Security¶
- Blocked SSRF private/metadata/obfuscated IP hosts, percent-encoded path traversal, non-ASCII header injection, mismatched injected client origins, and localhost URLs in production environments; froze configuration dataclasses against post-init mutation.
- Extended secret redaction across telemetry paths (
/v1_0/apiuser/<redacted>),ProductConfig,BcAuthorizeResponse,ProvisionResult, reference ID validators, and sanitizedBadRequestErrormessages. - Protected webhook and ASGI/Django verifiers against oversized header/timestamp/
Content-LengthDoS, duplicate multi-dict headers, non-short-circuiting multi-v1comparisons, replay delivery (replay_check), IPv6 zone IDs, and stream-consumption issues via Starletterequest._bodycaching.
Fixed¶
- Aligned provider contracts with live API specifications: MTN
ErrorReasonobject parsing, strict E.164 MSISDN and zero-decimal currency amount validation, CIBA OAuth2refresh_tokengrant,wait_for_settlementdeadline accuracy, Airtel country-aware MSISDN and HTTP 200 business-error inspection, M-Pesa Daraja EAT (UTC+3) timestamps / whole-integer KES amounts / B2C v3OriginatorConversationID, Wave livereceive_amountand no-dotWave-Signature(timestamp_separator=""), Flutterwave alphanumeric bank/IBAN preservation and currency balances, Paystack multi-currency balance selection and zero-decimal guards, and core transport explicitidempotentretry safety with CAS 401 token refresh and per-loop async locks. - Fixed false-positive Airtel amount and webhook telemetry isolation tests, added genuine chunked-stream, real
cryptography/FastAPI/Django, and multi-threaded/asyncio concurrency and stress tests (lifting total coverage to 95%). - Fixed MkDocs duplicate scroll-to-top button and
docs/javascripts/scroll.jsinstant-navigationscrolllistener leak, cleaned editorial wording, and updated all guides andREADME.md.
1.2.0 - 2026-11-21¶
Added¶
- Exported
py_momo_sdk.__version__,encrypt_airtel_pin(), per-requestcallback_urloverrides across MTN Collection, Disbursement, and Remittance write methods,payer_emailandpayee_bank_codeon unified provider DTOs,verify_transfer()on Paystack clients,get_transfer()on Flutterwave clients, andverify_webhook()/verify_webhook_hash()on async Wave, Paystack, and Flutterwave clients. - Brought
AirtelClientandAsyncAirtelClientto full transport parity with injectablehttpxclients,max_retriesandretry_backoff,TelemetryHookobservability, bounded streaming response reads, and safe alphanumericreference_idsupport.
Security¶
- Prevented automatic
PaymentRouterandAsyncPaymentRouterfailover on ambiguous5xxor network write failures unlessallow_ambiguous_write_fallback=Trueis explicitly set, while keeping safe pre-flight failover on authentication and missing-credential errors; enforced capability and currency filtering during candidate resolution. - Rejected HTTP
3xxredirects in_raise_for_statusand Airtel clients, validated injectedhttpxclient base URLs and per-requestfollow_redirects=False, and enforced a streamingmax_response_bytescap (1 MiBdefault) across sync and async HTTP clients. - Protected
WebhookHandler,create_asgi_webhook_verifier,verify_django_webhook_request, andverify_constant_time_tokenagainst non-ASCIIcompare_digesterrors, oversized request bodies, spoofed or IPv4-mapped IPv6 addresses, duplicatet=or signature headers, non-finitetolerance_seconds, and future timestamp skew. - Validated per-request callback/redirect URLs,
base_url,max_retries,retry_backoff, and"sandbox"vs"production"environment names across all provider configurations and direct client write methods; removedexample.comdefault callback URLs and production"testapi"initiator defaults; guarded Airtel production configurations against plaintext numeric PINs. - Added
allowed_pluginsallowlisting and protocol validation todiscover_provider_plugins(), securedmock_serverwith body-size and state-entry caps, socket timeouts, thread locking, and non-loopback bind protection, redacted/accountholder/{type}/{id}PII in logs and telemetry events, and isolated GitHub Actionsverify,build, andpublish/deploy-pagesjobs withoutcontents: write.
Fixed¶
- Fixed Airtel disbursement payload schema (
{payee, transaction, reference, pin}), Airtel currency validation, Orange Money countryapi_path_prefixand(order_id, amount)status tracking, Paystack minor-unit precision and envelope checks, Flutterwave explicitemailandaccount_bankhandling,kindvalidation across all 7 providers, status mappings (REVERSED,EXPIRED,CANCELLED, indeterminatePENDING), and documentation/CLI credential guidance.
1.1.0 - 2026-11-21¶
Added¶
- Asynchronous Airtel Money client (
AsyncAirtelClient,AsyncAirtelAuth,AsyncAirtelCollection,AsyncAirtelDisbursement). - Unified multi-provider orchestration (
PaymentProvider,AsyncPaymentProvider,PaymentRouter,AsyncPaymentRouter, normalized DTOs, andpy_momo_sdk.providersentry-point plugin discovery). - First-class provider clients and adapters for Wave, Safaricom M-Pesa (Daraja), Paystack, Flutterwave, and Orange Money alongside MTN MoMo and Airtel Money.
- Bounded idempotent retries with
Retry-Afterandsecrets-based jitter (max_retries,retry_backoff), injectablehttpxclients,wait_for_settlement()andasync_wait_for_settlement(),detect_carrier_from_msisdn(), andTelemetryHookobservability events. - Timestamped HMAC webhook verification (
WebhookHandler.verify_timestamped_hmac_signature), FastAPI/Starlette and Django raw-body webhook verifiers, local mock gateway server (start_mock_server_threadandpy-momo-sdk mock), andpy-momo-sdk carrier. - New documentation guides for multi-provider orchestration (
docs/providers.md) and resilience and observability (docs/resilience.md).
1.0.6 - 2026-11-20¶
Changed¶
- Renamed the brand, PyPI distribution, Python package, classes, CLI command, and environment variables from
Py MoMo API/py-momo-api/py_momo_api/PyMomoAPIto Py MoMo SDK (py-momo-sdk,py_momo_sdk,PyMomoSDK,AsyncPyMomoSDK,PyMomoSDKConfig,PyMomoSDKError,PyMomoSDKServerError, CLIpy-momo-sdk, andPY_MOMO_SDK_*). - Updated documentation, tests, and GitHub Pages site links to reflect
Py MoMo SDKandhttps://wkambale.github.io/pymomo/.
1.0.5 - 2026-11-20¶
Changed¶
- Redesigned the MkDocs documentation site with semantic CSS design tokens, variable
InterandJetBrains Monotypography (cv11,ss01,text-wrap: balance,text-wrap: pretty,tabular-nums), alternating surface bands, horizontally aligned card grids, SVG brand geometry, and an accessible icon-only scroll-to-top control. - Refined
README.mdand all documentation pages for strict editorial hygiene: sentence case throughout, zero ampersands in prose, zero em or en dashes, zero numbered headings or cards, and clear next-action navigation links.
1.0.4 - 2026-11-20¶
Changed¶
- Rebranded the project to Py MoMo SDK (
py-momo-sdkon PyPI, importable packagepy_momo_sdk, CLI commandpy-momo-sdk, andPY_MOMO_SDK_*environment variables). - Renamed core client, config, and exception classes to
PyMomoSDK,AsyncPyMomoSDK,PyMomoSDKConfig,PyMomoSDKError, andPyMomoSDKServerError. - Switched project license to MIT License (Copyright (c) 2026 Wesley Kambale) across
LICENSE,pyproject.toml, andREADME.md. - Updated all documentation, CLI help text, tests, and CI workflows to match
py_momo_sdk,py-momo-sdk, andPyMomoSDK.
1.0.3 - 2026-11-20¶
Changed¶
- Aligned package license metadata in
pyproject.tomlandREADME.md. - Updated package metadata, README, and documentation for
py-momo-sdk1.0.3 and Airtel Money coverage. - Updated
SECURITY.mdsupported versions to1.0.x. - Cleaned up trailing whitespace, missing EOF newlines, and non-UUID
api_userexample placeholders across documentation.
1.0.2 - 2026-11-20¶
Added¶
- Collection CIBA OAuth2 token exchange (
Collection.create_oauth2_tokenin sync and async clients) with secret-redactingOAuth2TokenResponse. - Webhook authenticity verification helpers: constant-time
WebhookHandler.verify_hmac_signature(SHA-256 and SHA-512) and fail-closedWebhookHandler.verify_source_ip. - Public sandbox provisioner factories
create_sandbox_provisioner(subscription_key)on sync and async clients. - CLI
--version/-Vflag,collection status <reference_id>command, and--base-urloption across commands. - Dedicated Airtel Money documentation (
docs/airtel.md) and PEP 561py.typedmarker.
Changed¶
- Enforced strict HTTPS base URL and relative request path validation, disabled automatic HTTP redirects (
follow_redirects=False), and validated canonical UUID v4 reference IDs, ISO currency/country codes, positive finite amounts, timeouts, callback URLs, and header control characters. - Validated response JSON and Pydantic model parsing across all MTN MoMo and Airtel endpoints via shared
parse_modelandparse_json_dicthelpers. - Added thread-safe and async-safe double-checked token refresh locking with conditional cache invalidation (
expected_token) to prevent concurrent token storms and stale invalidations. - Enforced secret redaction across configs, models, token caches, sandbox provisioners, HTTP error chains, and CLI error handling.
- Secured GitHub Actions workflows with SHA-pinned actions, least-privilege permissions, strict Hatch sdist/wheel packaging allowlists, and full Bandit scanning without global rule skips.
Fixed¶
- Fixed
AirtelTransactionResponse.is_successful(),is_pending(), andis_failed()to evaluatedata.transaction.statusrather than outer envelope result codes, and fixed the Airtel disbursement status endpoint path (/standard/v1/disbursements/{id}). - Fixed Python 3.11+ enum string interpolation for
AccountHolderIdTypepath segments. - Fixed MkDocs root configuration and updated documentation examples to use valid UUID v4 values and public APIs.
0.1.0 - 2026-06-15¶
Added¶
- First public release of the client library.
- Complete Collection product client (request to pay, request to withdraw, balances, consent queries).
- Complete Disbursement product client (transfers, deposits, refunds, balances).
- Complete Remittance product client (transfers, balances).
- Standard and asynchronous client implementations.
- Sandbox API user and API key provisioning helpers.
- Typer-based command-line interface tool.
- Webhook JSON payload parse utilities.