Heleket Python integration (reference)
A production-grade reference SDK for the Heleket cryptocurrency payment API. Written for Python 3.11+, published as heleket-sdk — works with FastAPI, Django, Flask, or plain scripts.
Covers the full documented surface (payments, payouts, balance, services, exchange rates), ships with pytest tests, runnable examples, byte-fidelity webhook verification, debug mode wired into your choice of logger, a heleket-webhook-inspect CLI, and a Docker harness.
Runtime dependencies: Pydantic v2 (typed DTOs) and requests (HTTP). Everything else comes from the standard library.
Quickstart
from heleket_sdk import HeleketPayment
from heleket_sdk.types import CreateInvoiceRequest
client = HeleketPayment(merchant_id=merchant_id, api_key=payment_key)
invoice = client.create_invoice(
CreateInvoiceRequest(
amount="15.00",
currency="USD",
order_id="order-42",
lifetime=3600,
)
)
print(invoice.url) # → https://pay.heleket.hk/pay/<uuid>
Custom domain
Requests go to https://api.heleket.hk by default. Use domain to target another
domain (https://api.<domain>); an explicit base_url overrides it:
from heleket_sdk import ClientOptions, HeleketPayment
HeleketPayment(merchant_id=..., api_key=..., options=ClientOptions(domain="example.org"))
Install
poetry add heleket-sdk
# or
pip install heleket-sdk
Requirements: Python 3.11+ (StrEnum, Self type, better type hints). Tested with CPython 3.11 and 3.12.
Documentation
Full reference lives in docs/:
- 01 — Installation
- 02 — Configuration
- 03 — Architecture
- 04 — Payments API
- 05 — Payouts API
- 06 — Webhooks ⚑ critical reading
- 07 — Debugging
- 08 — Testing
- 09 — Error handling
- 10 — Reference (statuses, currencies, endpoints)
- 12 — Troubleshooting
What's in the box
src/heleket_sdk/ Source — single source of truth
src/heleket_sdk/webhook Webhook signature verifier (byte-fidelity)
tests/ pytest suite + FakeTransport for offline testing
examples/ Twelve runnable scripts covering every endpoint
bin/ heleket-webhook-inspect — CLI for verifying webhook payloads
docker/ Multi-stage Dockerfile (python:3.11-slim)
docs/ Full module documentation
CHANGELOG.md Notable changes per release
UPGRADING.md Migration notes between versions
pyproject.toml Poetry build + ruff + mypy + pytest config
Common tasks
make install # poetry install --with dev
make test # pytest -q
make lint # ruff check
make fmt # ruff format
make fmt-check # ruff format --check
make typecheck # mypy in strict mode
make qa # All quality gates
make example-invoice # Create a real invoice (needs .env)
make example-webhook # Run the webhook listener on :8000
make webhook-inspect KEY=$K FILE=evt.json # Inspect a captured webhook
make docker-shell # Drop into a containerized Python 3.11 shell
make help # Full target list
Security notes (read this)
- Use
verify_rawfor production webhooks.verify(decoded)is convenience-only and lossy — it can't recover the PHP-style\/slash escapes that Heleket's server sends. See docs/06-webhooks.md. - De-duplicate replays. Use a
(uuid, status)key in your DB before doing side-effect work. SQLAlchemy and redis-py examples in docs/06-webhooks.md. - Whitelist Heleket's webhook source IP
31.133.220.8at your reverse proxy or firewall. - Two separate API keys — payments and payouts. Mixing them breaks webhook verification. (One exception:
/v1/payment/refunduses the payout key — callHeleketPayout.refund().) - The SDK never logs API keys. Debug-mode entries include URL, method, body, and status — but the
signheader and API key are explicitly excluded.
License
MIT.
Metadata
Release files for heleket-sdk 0.4.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 |
|---|---|---|---|---|
| heleket_sdk-0.4.0.tar.gz | 22.5 kB | With provenance | Details for heleket_sdk-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| heleket_sdk-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for heleket_sdk-0.4.0-py3-none-any.whl |
Total release size: 48.2 kB
Release files / heleket_sdk-0.4.0.tar.gz
| Download URL | heleket_sdk-0.4.0.tar.gz |
|---|---|
| Size | 22.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9fd0a60dce505d9541fed4c36027b19a61d5ea97712fb7c502be271a21f73fa2
|
|
BLAKE2b-256 checksum How to use checksums |
9ae8a6e710d3030ea68942d3964186a88999e35392e319d8fc63e19757d8e931
|
| 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 14, 2026.
Transparency logRelease files / heleket_sdk-0.4.0-py3-none-any.whl
| Download URL | heleket_sdk-0.4.0-py3-none-any.whl |
|---|---|
| Size | 25.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2a8cdf0ad15e83e0c0add17d3a9fcac69ecbd82f26b5be1f7c20e0c999255ac7
|
|
BLAKE2b-256 checksum How to use checksums |
75d92a9943e1478c34a903969ccabf5938b44c4f2c0e300564083e2be777fbe2
|
| 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 14, 2026.
Transparency logSecurity for heleket-sdk 0.4.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 heleket_sdk-0.4.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 14, 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.