bazik-sdk (Python)
Async Python client for the Bazik API — MonCash & NatCash payments, payouts, transfers and wallet for Haiti 🇭🇹. Fully typed, one dependency (httpx), production-tested.
Install
pip install bazik-sdk
Quick start
import asyncio
from bazik import BazikClient, STATUS_SUCCESSFUL
async def main():
async with BazikClient(user_id="YOUR_USER_ID", secret_key="YOUR_SECRET_KEY") as bazik:
# Create a MonCash payment (amount in gourdes, max 75,000 HTG)
order = await bazik.create_moncash_payment(
gdes=500,
reference_id="INV-1001",
description="Pro plan",
customer_first_name="Jean",
customer_last_name="Pierre",
customer_email="jean@example.com",
webhook_url="https://api.yoursite.com/billing/moncash/webhook",
success_url="https://yoursite.com/paid",
error_url="https://yoursite.com/canceled",
)
print("Send the customer to:", order["redirectUrl"])
# Poll until it resolves
result = await bazik.wait_for_completion(order["orderId"], interval=3, timeout=180)
print("Paid!" if result.get("status") == STATUS_SUCCESSFUL else result.get("status"))
asyncio.run(main())
BazikClientworks both as anasync withcontext manager (reuses one connection pool) and standalone — callawait bazik.aclose()when you're done.
API reference
Payments
| Method | HTTP | Description |
|---|---|---|
create_moncash_payment(*, gdes, reference_id, webhook_url=…, description=…, customer_first_name=…, customer_last_name=…, customer_email=…, success_url=…, error_url=…) |
POST /moncash/token |
Create a MonCash payment → {orderId, redirectUrl, status} |
verify_payment(order_id) |
GET /order/{id} |
Current status → {status, referenceId, …} |
is_paid(order_id) |
— | True if status == successful |
wait_for_completion(order_id, *, interval=3, timeout=180) |
— | Poll until resolved |
withdraw(*, gdes, wallet, description=…) |
POST /moncash/withdraw |
Payout to a MonCash wallet |
get_balance() |
GET /balance |
Account balance {available, reserved} |
Transfers
| Method | HTTP | Description |
|---|---|---|
check_customer(wallet) |
POST /moncash/customers/status |
KYC status of a wallet |
transfer_moncash(*, gdes, wallet, customer_first_name=…, customer_last_name=…, description=…) |
POST /moncash/transfers |
MonCash transfer → {transactionId} |
transfer_natcash(*, gdes, wallet, customer_first_name=…, customer_last_name=…) |
POST /natcash/transfers |
NatCash transfer → {transactionId} |
transfer_status(transfer_id) |
GET /transfers/{id} |
Transfer status |
quote(*, gdes, provider="moncash") |
POST /transfers/quote |
Fee quote before a transfer |
Wallet & auth
| Method | HTTP | Description |
|---|---|---|
wallet_balance() |
GET /wallet |
Wallet balance (HTG) |
authenticate() |
POST /token |
Fetch & cache a bearer token (auto-called) |
Status constants: STATUS_PENDING, STATUS_SUCCESSFUL, STATUS_FAILED, STATUS_CANCELLED.
Errors raise bazik.BazikError with .status_code and .body.
Amount field is
gdes(gourdes) — nevergourdes. The wrong key creates a payment with no amount.
Webhook verification (don't trust the body)
Bazik POSTs { orderId } to your webhook_url. Always re-verify before fulfilling:
async def webhook(payload: dict, bazik: BazikClient):
order_id = payload.get("orderId")
if order_id and await bazik.is_paid(order_id):
... # activate the order
Examples
# Payout 250 HTG to a wallet
await bazik.withdraw(gdes=250, wallet="509xxxxxxxx", description="Refund")
# Quote fees, then transfer
q = await bazik.quote(gdes=1000, provider="moncash")
tx = await bazik.transfer_moncash(gdes=1000, wallet="509xxxxxxxx", customer_first_name="Marie")
print(await bazik.transfer_status(tx["transactionId"]))
# Balances
print(await bazik.get_balance()) # account
print(await bazik.wallet_balance()) # wallet
License
MIT © Falandy Jean. Unofficial SDK — not affiliated with Bazik.
Metadata
Release files for bazik-sdk 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 | |
|---|---|---|---|
| bazik_sdk-0.2.0.tar.gz | 6.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bazik_sdk-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.8 kB
Release files / bazik_sdk-0.2.0.tar.gz
| Download URL | bazik_sdk-0.2.0.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4613c598659b5d9e362c1f792237d5b6f79f946fbf8a265388a30965b57b0428
|
|
BLAKE2b-256 checksum How to use checksums |
79360222c47f78835871fa3ad2f6e57f0d1617326854fffc47cc4d6683ba1a39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Release files / bazik_sdk-0.2.0-py3-none-any.whl
| Download URL | bazik_sdk-0.2.0-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
41681ccf1f04ddce3bff4ddaf7280f104f3d99471cad5ec2deb9fd1ac6196a66
|
|
BLAKE2b-256 checksum How to use checksums |
4c772fc787db61b551e63e3231a48c51f808c97d52c6d4529bdc4cc72d793854
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|