Nomba Python SDK
A Python client for Nomba's payments and banking APIs: checkout, transfers, virtual accounts, direct debits, terminals, electricity, cable TV, betting, airtime and data, cross-border payouts and collections, webhooks, and account/transaction lookups.
Status: this is a port of the Node SDK onto Nomba's published API docs. It has not yet been verified against the live sandbox API — treat response shapes and edge-case behavior as best-effort until that verification happens.
Typed params and responses (TypedDicts and dataclasses), a settle-into-one-outcome pattern for money-moving calls, automatic token handling, and webhook verification. Python 3.12 or newer. The only dependency is httpx.
Install
pip install nomba
Quickstart
import os
from nomba import Nomba
client = Nomba(
client_id=os.environ["NOMBA_CLIENT_ID"],
client_secret=os.environ["NOMBA_CLIENT_SECRET"],
account_id=os.environ["NOMBA_ACCOUNT_ID"],
environment="sandbox", # "production" (default) or "sandbox"
)
order = client.checkout.create_order(
{
"orderReference": "order-1234",
"customerEmail": "customer@example.com",
"amount": 5000,
"currency": "NGN",
"callbackUrl": "https://example.com/callback",
}
)
print(order.checkoutLink) # send the customer here to pay
The SDK issues an access token on first use and refreshes it automatically before it expires — no manual token handling required.
Configuration
| Option | Default | Notes |
|---|---|---|
client_id |
— | Required. |
client_secret |
— | Required. |
account_id |
— | Required. Parent account ID of the business. |
environment |
"production" |
"production" or "sandbox". Sandbox and production credentials are not interchangeable. |
token_store |
in-memory, single process | See Token handling. |
http_client |
a new transport | Mainly for tests; injects a custom HttpClient. |
Resources
Every resource hangs off the client (client.<resource>), and every method maps to one documented Nomba endpoint. Body parameters are TypedDicts with Nomba's field names; responses are typed dataclasses.
Accounts
account = client.accounts.get_parent_account()
print(account.accountName, account.currency)
for terminal in client.accounts.iterate_parent_terminals():
print(terminal.terminalId)
Transfers
from nomba import NombaError, UnconfirmedOutcomeError
banks = client.transfers.list_banks()
result = client.transfers.bank_transfer(
"payout-9981", # merchant_tx_ref: your own reference, the idempotency key
amount=1000,
accountNumber="0123456789",
accountName="Jane Doe",
bankCode=banks[0].code,
on_success=lambda data: print("sent:", data),
on_pending=lambda data: print("still processing, requery later:", data),
on_failed=lambda err: print("failed:", err),
)
Every money-moving method (bank transfers, wallet transfers, bill payments, airtime/data purchases, mandate debits...) takes on_success/on_pending/on_failed callbacks. Without them, success returns the response data, a pending/undocumented outcome raises UnconfirmedOutcomeError, and a failure raises NombaError. Reuse the same merchant_tx_ref when checking on a pending transfer — never generate a new one to retry it.
Virtual accounts, checkout, charge, terminals, direct debits
client.virtual_accounts.create(**{...})
client.checkout.create_order({...}) # order dict is positional
client.charge.submit_card_details(**{...})
client.terminals.assign_to_parent(**{...})
client.direct_debits.create_mandate(**{...})
Bills (version 1 lookups) and bill payments (version 2)
providers = client.bill_electricity.get_electricity_providers()
plans = client.bill_data.get_data_plans("mtn")
client.electricity.pay_electricity("bill-5521", **{...})
client.data.buy_data("bill-5522", **{...})
client.airtime.buy_airtime("bill-5523", **{...})
Transactions and requery
page = client.transactions.list_parent_transactions(limit=50)
client.requery.requery_by_session(session_id)
Global payouts and collections
client.payouts.exchange_rates(**{"from": "USD", "to": "CDF"})
client.collections.initiate_inflow(**{...})
Webhooks
from nomba import verify_signature
is_valid = verify_signature(
body=request.body, # raw request body (str or bytes)
signature=request.headers["nomba-signature"],
timestamp=request.headers["nomba-timestamp"],
secret=os.environ["NOMBA_WEBHOOK_SECRET"],
)
verify_signature never raises — a missing or malformed signature or body returns False.
| Resource | Covers |
|---|---|
client.accounts |
Parent and sub-account details, balances, assigned terminals |
client.virtual_accounts |
Create, update, expire, look up and list virtual accounts |
client.checkout |
Hosted checkout orders, refunds, tokenized cards |
client.charge |
Custom card payment flow: card details, OTP, saved cards |
client.transfers |
Bank list, account lookup, bank and wallet transfers |
client.direct_debits |
Direct debit mandates: create, debit, list, suspend/reactivate |
client.terminals |
Assign/unassign POS terminals, push payment requests |
client.transactions |
List and filter transactions on parent, sub and virtual accounts |
client.requery |
Look up one transaction's current status |
client.bill_electricity / .bill_cable / .bill_betting / .bill_data |
Bill lookups (version 1): provider lists, plans, customer lookup |
client.electricity / .cable / .betting |
Bill payments (version 2) |
client.airtime / .data |
Airtime and data bundle purchases (version 2) |
client.collections |
DRC mobile money inflows |
client.payouts |
Currency wallets, exchange rates, cross-border transfers |
client.webhooks |
Webhook delivery logs, subscriptions, re-push/bulk re-push, replay |
nomba.verify_signature |
Check a webhook's signature |
Outcome handling
The SDK never guesses on a money-moving call. Every outcome settles into exactly one of three states, using only the codes and statuses Nomba's docs list for that endpoint:
| Outcome | Meaning | Default behavior without a callback |
|---|---|---|
success |
A documented success code/status. Safe to fulfil the order. | Returns the response data. |
pending |
Final status unknown, or an undocumented code/status came back. Wait for the webhook or requery. | Raises UnconfirmedOutcomeError (or OutcomeUnknownError on a transport failure). |
failed |
A documented rejection. Safe to tell the customer it failed. | Raises NombaError. |
Pass on_success / on_pending / on_failed to handle each case explicitly instead of catching exceptions.
Every money-moving call requires a caller-supplied idempotency key (merchant_tx_ref or equivalent) — the SDK never generates one, to avoid ever double-disbursing funds. Omitting it raises IdempotencyKeyAbsentError. Reuse the same key when requerying or retrying a pending call; never mint a new one.
Errors
| Exception | Subclass of NombaError? |
When |
|---|---|---|
NombaError |
— | Any non-2xx response, or a 2xx whose body code is not one the call accepts. |
UnconfirmedOutcomeError |
No | A money-moving call got a readable answer whose body code or status is undocumented. May still complete. |
OutcomeUnknownError |
No | A money-moving call failed in a way that doesn't say whether it was processed (timeout, network error, 5xx, 409). |
TokenError |
No | Getting or renewing the access token failed; the request was never sent. |
IdempotencyKeyAbsentError |
No | A money-moving request was attempted without a caller-supplied idempotency key. |
OutcomeUnknownError, UnconfirmedOutcomeError, TokenError and IdempotencyKeyAbsentError are deliberately not subclasses of NombaError, so except NombaError can never treat a payment that may have gone through as failed. Use nomba.lib.errors.is_pending(err) to check for either pending case.
Token handling
The client gets an access token on first use, refreshes it automatically before it expires, and shares one in-flight token request between concurrent calls. Tokens live in memory by default.
from nomba import Nomba
from nomba.lib.token_store import TokenStore
client = Nomba(..., token_store=my_token_store) # implements TokenStore
Pagination
Paginated list methods have an iterate_* counterpart that lazily walks every page for you:
for terminal in client.accounts.iterate_parent_terminals():
print(terminal.terminalId)
Development
uv sync # install the package and dev tools
uv run ruff check . # lint
uv run ruff format . # format
uv run mypy # type-check (strict)
uv run pytest # tests
See CONTRIBUTING.md for the full contribution guide (Nomba-docs-first, tests required, Conventional Commits).
Links
License
Metadata
Release files for nomba 0.2.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 |
|---|---|---|---|---|
| nomba-0.2.0.tar.gz | 43.8 kB | With provenance | Details for nomba-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nomba-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for nomba-0.2.0-py3-none-any.whl |
Total release size: 116.7 kB
Release files / nomba-0.2.0.tar.gz
| Download URL | nomba-0.2.0.tar.gz |
|---|---|
| Size | 43.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1a0e11461d70d7c67a37d425d579389168916bf6ebf9ec9047d098eb0200b503
|
|
BLAKE2b-256 checksum How to use checksums |
4db9c2997b5bc426e402d1a06da8f3ad092537c27e2ef9229f9203519178b6a0
|
| 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 27, 2026.
Transparency logRelease files / nomba-0.2.0-py3-none-any.whl
| Download URL | nomba-0.2.0-py3-none-any.whl |
|---|---|
| Size | 72.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ba558123daae32f202581ea897cbc6897e4319f9c8eea77c97a9c011dae0203f
|
|
BLAKE2b-256 checksum How to use checksums |
7b68e7bf12a7e5a3edb8e6175706c986e8b1d60a283b8dd4c7ca071ba6c1994b
|
| 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 27, 2026.
Transparency logSecurity for nomba 0.2.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 nomba-0.2.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 27, 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.