africa-payments-webhooks (Python)
Verify and normalise payment webhooks from Paystack, Flutterwave, Monnify, Squad, Korapay, Fincra, Interswitch and Nomba — zero dependencies, with helpers for Django, Flask and FastAPI. Same behaviour and test vectors as the npm package.
pip install africa-payments-webhooks
Django
from africa_payments_webhooks.adapters.django import webhook_view
def on_event(event):
if event.type == "payment.succeeded":
mark_order_paid(event.reference) # event.amount == {"value": 20000, "unit": "minor", "currency": "NGN"}
urlpatterns = [path("webhooks/paystack/", webhook_view(provider="paystack", secret=settings.PAYSTACK_SECRET_KEY, on_event=on_event))]
Flask
from africa_payments_webhooks.adapters.flask import webhook_view
app.add_url_rule("/webhooks/monnify", view_func=webhook_view(provider="monnify", secret=os.environ["MONNIFY_CLIENT_SECRET"], on_event=on_event), methods=["POST"], endpoint="monnify")
FastAPI
from africa_payments_webhooks.adapters.fastapi import webhook_endpoint
app.add_api_route("/webhooks/flutterwave", webhook_endpoint(provider="flutterwave", secret=os.environ["FLW_SECRET_HASH"], on_event=on_event), methods=["POST"])
(on_event may be async. Don't declare a Pydantic body on this route — the raw bytes are needed.)
Any framework
from africa_payments_webhooks import verify, parse
result = verify("korapay", raw_body=raw_bytes, headers=headers, secret=KORAPAY_SECRET_KEY)
if not result: # result.code: "invalid_signature" | "missing_signature" | ...
return 401
event = parse("korapay", raw_bytes)
Options: secret=[new, old] (rotation), store= (dedupe: implement claim(id, ttl) / release(id)),
ip_allowlist=True (published IPs, optional extra), allow_unsigned_sandbox=True (Monnify sandbox only — never in
production), tolerance_seconds=300 (Nomba replay window).
Test helper: from africa_payments_webhooks.testing import sign_test_payload.
See the main README for the provider table, amount units, the raw-body rule and the security model. MIT © Evergreene Software LTD.
Metadata
Release files for africa-payments-webhooks 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 |
|---|---|---|---|---|
| africa_payments_webhooks-0.1.0.tar.gz | 42.0 kB | With provenance | Details for africa_payments_webhooks-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| africa_payments_webhooks-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for africa_payments_webhooks-0.1.0-py3-none-any.whl |
Total release size: 59.1 kB
Release files / africa_payments_webhooks-0.1.0.tar.gz
| Download URL | africa_payments_webhooks-0.1.0.tar.gz |
|---|---|
| Size | 42.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3989b4552239ac784585e6b89da53916a98ca09f86330762f050548941c9b23e
|
|
BLAKE2b-256 checksum How to use checksums |
45ef51b2cbd10ec0f3efae79359c54abee3bfe831355b823a7d3c593aa2c410b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 12, 2026.
Transparency logRelease files / africa_payments_webhooks-0.1.0-py3-none-any.whl
| Download URL | africa_payments_webhooks-0.1.0-py3-none-any.whl |
|---|---|
| Size | 17.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b9f5dd28c4d08aed982eeff0e78552956bdf0638364610c2a2d10a7c72610b0
|
|
BLAKE2b-256 checksum How to use checksums |
0f79039dcc9364586f136621bbdf0ff81600ceb986fc15fa70333db3b51bbe53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 12, 2026.
Transparency logSecurity for africa-payments-webhooks 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 africa_payments_webhooks-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 Nov 12, 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.