Async Python SDK for the Bazik API — MonCash & NatCash payments, payouts, transfers and wallet for Haiti.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bazik_sdk-0.2.0.tar.gz.
File metadata
- Download URL: bazik_sdk-0.2.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4613c598659b5d9e362c1f792237d5b6f79f946fbf8a265388a30965b57b0428
|
|
| MD5 |
ddb17b249f34fca88642f41f996a4c35
|
|
| BLAKE2b-256 |
79360222c47f78835871fa3ad2f6e57f0d1617326854fffc47cc4d6683ba1a39
|
File details
Details for the file bazik_sdk-0.2.0-py3-none-any.whl.
File metadata
- Download URL: bazik_sdk-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41681ccf1f04ddce3bff4ddaf7280f104f3d99471cad5ec2deb9fd1ac6196a66
|
|
| MD5 |
033426a603fa9ceedc9c060c9362072e
|
|
| BLAKE2b-256 |
4c772fc787db61b551e63e3231a48c51f808c97d52c6d4529bdc4cc72d793854
|