Skip to main content

Async Python SDK for the Bazik API — MonCash payments for Haiti.

Project description

bazik-sdk (Python)

Tiny async Python client for the Bazik API — MonCash payments for Haiti. Production-tested (powers payments on TradeMakaya). One dependency: httpx.

Install

pip install bazik-sdk

Quick start

import asyncio
from bazik import BazikClient

async def main():
    client = BazikClient(user_id="YOUR_USER_ID", secret_key="YOUR_SECRET_KEY")

    # 1) Create a payment (amount in gourdes, max 75,000 HTG)
    order = await client.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"])

    # 2) Check status (or poll until it resolves)
    result = await client.wait_for_completion(order["orderId"], interval=3, timeout=180)
    print("Status:", result["status"])   # "successful" | "pending" | "failed"

asyncio.run(main())

API

Method Description
BazikClient(user_id, secret_key, base_url=…, timeout=20) Create a client.
await authenticate() Fetch & cache a bearer token (auto-called).
await create_moncash_payment(*, gdes, reference_id, …) Create a MonCash payment → {orderId, redirectUrl, …}.
await verify_payment(order_id) Current status → {status, referenceId, …}.
await wait_for_completion(order_id, *, interval=3, timeout=180) Poll until resolved.

create_moncash_payment optional fields: webhook_url, description, customer_first_name, customer_last_name, customer_email, success_url, error_url.

Errors raise bazik.BazikError (.status_code, .body).

Note: the amount field is gdes (gourdes) — not gourdes. Sending the wrong key creates a payment with no amount.

Webhook flow

Bazik POSTs { orderId } to your webhook_url on a status change. Don't trust the body — verify:

verified = await client.verify_payment(order_id)
if verified["status"] == "successful":
    ...  # activate the order

License

MIT © Falandy Jean. Unofficial SDK; not affiliated with Bazik.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bazik_sdk-0.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bazik_sdk-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file bazik_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: bazik_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for bazik_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 633d369a5676da4b9b01e70a3e430ed275dc4deac41aa48c53155189db15297b
MD5 5f2a471adcc7059b20ca065cddbcb3bb
BLAKE2b-256 b7bd48f8a93c0d268769826c0a37f2e5828e0c79a985675b539cb1966b5b1bde

See more details on using hashes here.

File details

Details for the file bazik_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bazik_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for bazik_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fd6f204480e20827c13ba83419c09c9b831c40cdcc95b4d98024cdd252963178
MD5 58b5f237c3f2c06657758fdf4c7b900b
BLAKE2b-256 992fd32d9b576446fbd7a4e5ccab68e2b91ac7f7c9b5ff78a1247a78dda16054

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page