Python
Official server-side SDK (wajub) for Python 3.10+ — payments, payouts, webhooks, and the full merchant API.
12 min read
Python is Wajub's official server-side SDK for Django, FastAPI, Flask, and any Python 3.10+ backend. It is published as wajub on PyPI.
Use it with your API key (pk_… / sk_… / rk_…, including test variants). Pair it with @wajub/js in the browser.
Browser vs server
@wajub/js runs in the browser with publishable keys.
wajub runs on the server — pass any merchant API key
(pk., sk., rk.) and use webhook verification for inbound
events. Never expose sk. keys to the client.
Install
pip install wajubRequires Python 3.10+ and httpx.
Quick start
import os
from wajub import Wajub
wajub = Wajub(api_key=os.environ["WAJUB_SECRET_KEY"])
payment = wajub.payments.create({
"amount": 15000,
"currency": "XAF",
"email": "buyer@example.com",
"callback": "https://shop.example.com/order/complete",
})
print(payment["authorization_url"])Configuration
| Option | Description |
|---|---|
api_key | Merchant API key (pk.… / sk.… / rk.…, test or live) |
webhook_secret | Signing secret (whsec_…) for webhooks.construct_event() |
idempotency_key_prefix | Prefix for auto-generated Idempotency-Key headers |
Resources
| Attribute | Methods |
|---|---|
wajub.global_ | ping, channels, countries, currencies (global is a Python keyword) |
wajub.payments | create, initialize, retrieve, list, cancel, process, process_split, list_refunds |
wajub.customers | CRUD + block, unblock, activate, deactivate, tax IDs |
wajub.refunds | CRUD + list |
wajub.transfers | CRUD + list |
wajub.beneficiaries | CRUD + list |
wajub.links | CRUD + list |
wajub.invoices | CRUD + send, mark_paid, cancel |
wajub.accounts | CRUD + regenerate_token |
wajub.webhook_endpoints | CRUD + rotate_secret |
wajub.balance | retrieve |
wajub.events | list, retrieve, resend |
wajub.disputes | list, retrieve, submit_evidence, accept, close, send_message |
wajub.identity | resolve, validate |
wajub.tax | settings, rates, calculate, reports, codes, registrations |
wajub.shield | settings, stats, blocklist |
wajub.listen | config, auth |
wajub.webhooks | construct_event |
Webhooks (Flask / Django / FastAPI)
event = wajub.webhooks.construct_event(
request.data,
request.headers["X-Wajub-Signature"],
request.headers["X-Wajub-Timestamp"],
)
# Handle payment.succeeded, transfer.succeeded, etc.Sync (Connect)
from wajub.request_options import RequestOptions
wajub.payments.create(params, RequestOptions(sync="acct_sync_ref"))Was this page helpful?