Official Python SDK for Ha Tang (hatang.dev): support CRM, plans and purchases, AI knowledge, email, payments, webhooks.
The official Python SDK for Ha Tang: support CRM, plans and purchases on the customer's profile, the AI assistant's knowledge, email, VietQR payments and webhooks.
pip install hatang Python 3.9+. Sync (Hatang) and asyncio (AsyncHatang) clients, typed request bodies.
from hatang import Hatang hatang = Hatang() # reads HATANG_API_KEY; or Hatang("ht_…") # What a customer pays for, from your backend (web sales included). hatang.chat.subscriptions.upsert("web", "sub_123", { "status": "active", "sku": "PRO-1M", # finds the product in your catalog "external_user_id": "user-42", # the id you pass to identify() in the chat "current_period_end": "2026-12-01T00:00:00Z", "amount": 99000, "currency": "VND", }) hatang.chat.purchases.upsert("web", "order_981", { "store_product_id": "credits.300", "sku": "XU-300", "kind": "consumable", "external_user_id": "user-42", "amount": 29000, "currency": "VND", }) asyncio (FastAPI, aiohttp…):
from hatang import AsyncHatang async with AsyncHatang() as hatang: hits = await hatang.knowledge.search("hoàn tiền", limit=3) Every method returns the API's JSON as a dict. A call that does not succeed raises HatangError with status_code (0 when Ha Tang was not reached), name (validation_error, not_found…), message, and retryable (unreachable, 429 or 5xx).
from hatang import identity_hash, purchase_token, construct_webhook_event, construct_ipn_event # Signed chat identity: send this as `hash` with userId to identify() in the widget or the app SDKs. identity_hash("user-42", IDENTITY_SECRET) # StoreKit appAccountToken / Google Play obfuscatedAccountId for one of your users. purchase_token("site_…", "user-42") # Webhooks (whsec_… secret) and payment IPN calls: pass the raw body, before JSON parsing. event = construct_webhook_event(request.body, request.headers, WEBHOOK_SECRET) ipn = construct_ipn_event(request.body, request.headers, SECRET_KEY) Both raise HatangSignatureError when the signature does not match; verify_webhook / verify_ipn return a bool.
All 2 files in this release have provenance metadata.
chat crm email hatang in-app purchases support vietqr webhooks
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
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 verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.
All 2 files in this release have been uploaded with provenance metadata.
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.




