Skip to main content

Reference Python SDK for the Heleket cryptocurrency payment API: payments, payouts, balance, exchange rates, and signed webhooks.

Project description

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.com/pay/<uuid>

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/:

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_raw for 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.8 at your reverse proxy or firewall.
  • Two separate API keys — payments and payouts. Mixing them breaks webhook verification. (One exception: /v1/payment/refund uses the payout key — call HeleketPayout.refund().)
  • The SDK never logs API keys. Debug-mode entries include URL, method, body, and status — but the sign header and API key are explicitly excluded.

License

MIT.

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

heleket_sdk-0.3.0.tar.gz (21.7 kB view details)

Uploaded Source

Built Distribution

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

heleket_sdk-0.3.0-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file heleket_sdk-0.3.0.tar.gz.

File metadata

  • Download URL: heleket_sdk-0.3.0.tar.gz
  • Upload date:
  • Size: 21.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for heleket_sdk-0.3.0.tar.gz
Algorithm Hash digest
SHA256 3ba9e52712eaee937d509ff8e6f29f46176cd63917115a0f86f596819ad7229b
MD5 10502f914e2caff51f12f043d98962ea
BLAKE2b-256 a8831a5e83037f17829dda9003aa8956d5effc2d1e84cd12ddf931b41365d752

See more details on using hashes here.

File details

Details for the file heleket_sdk-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: heleket_sdk-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for heleket_sdk-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c3b30c2cbfeebf95ca45e903e37ab3847a923000ca901ac2ba3d094cc1f85543
MD5 c79fb1b1fc247de103a8ba269a88b769
BLAKE2b-256 2874cc9c088617ee2892b950ebbe55e2f852f6a66426b337bcc5239201ce5164

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