Skip to main content

Production-oriented Django integration for the Click.uz payment gateway

Project description

django-click-uz

CI PyPI Python Django Click.uz

Production-oriented Django 5+ integration for the Click.uz Shop API: payment URLs, prepare/complete webhooks, MD5 signatures, optional audit log, replay protection, HTTPS / IP checks for callbacks.

Uzbek (full tutorial) README_UZ.md
Changelog CHANGELOG.md
Repository github.com/Matnazar-Matnazarov/django-click-uz
Extra Markdown docs docs/ (MkDocs sources)

What’s in the package

Part Role
click_uz Django app: INSTALLED_APPS, migrations, urls, views (prepare / complete / callback / webhook), webhook_guard, ModelOrderHandler, signals, Uzbek locale/uz.
click_up Same codebase, import-only compatibility (ClickUp, ClickWebhook, generate_pay_link style). Not an INSTALLED_APPS entry.
Config CLICK dict or flat CLICK_* settings; optional WEBHOOK_ALLOWED_CIDRS, WEBHOOK_REQUIRE_HTTPS, etc.
Tests / dev pytest, ruff, mkdocs (optional local doc site).

Requirements

  • Python 3.12+
  • Django 5.0+

Install

pip install django-click-uz
INSTALLED_APPS = [
    # ...
    "click_uz",
]

Configuration (summary)

Option A — CLICK dict (recommended):

CLICK = {
    "SERVICE_ID": os.getenv("CLICK_SERVICE_ID"),
    "MERCHANT_ID": os.getenv("CLICK_MERCHANT_ID"),
    "SECRET_KEY": os.getenv("CLICK_SECRET_KEY"),
    "ACCOUNT_MODEL": "order.Order",
    "AMOUNT_FIELD": "amount",
    "STATUS_FIELD": "status",
    "STATUS_WAITING": "waiting_payment",
    "MERCHANT_TRANS_FIELD": "transaction_param",
    "COMMISSION_PERCENT": 0,
    "DISABLE_ADMIN": False,
}

Option B — flat CLICK_* (legacy click-pkg style): see Configuration in docs/.

Webhooks need HANDLER_CLASS or ACCOUNT_MODEL + AMOUNT_FIELD + STATUS_FIELD. If both dict and flat keys exist, CLICK wins.


Integration checklist

  1. settings.pyclick_uz in INSTALLED_APPS; set CLICK or CLICK_*.
  2. models.py — order model with amount, status, optional transaction_param.
  3. urls.py — e.g. path("payment/click/", include("click_uz.urls")) → webhook at …/payment/click/webhook/, or mount your own ClickWebhook subclass.
  4. views.py — override successfully_payment, cancelled_payment, optional prepare_accepted.
  5. Pay linkClickUp().initializer.generate_pay_link(...); see README_UZ.md for stable vs unique transaction_param.
  6. Migratepython manage.py migrate.

Compared to older click-pkg tutorials: PyPI name is django-click-uz; only click_uz goes in INSTALLED_APPS.


Documentation (local)

There is no hosted ReadTheDocs site for this repo. To browse the MkDocs site locally:

uv sync --all-extras   # or: pip install -e ".[dev]"
mkdocs serve

Then open the URL shown in the terminal (usually http://127.0.0.1:8000). Sources live under docs/.


Security & operations

  • Click JSON responses use English; admin/config strings can use click_uz translations (locale/uz/).
  • Signature checks on webhook payloads are the main authenticity control.
  • HTTPS + optional IP allowlist: click_uz.webhook_guard and CLICK["WEBHOOK_*"]; behind TLS termination set SECURE_PROXY_SSL_HEADER.

Development

pip install -e ".[dev]"
pytest

Release workflow: bump version in pyproject.toml, update CHANGELOG.md, commit, then tag vX.Y.Z (e.g. v0.1.1) and git push origin vX.Y.Z — see .github/workflows/publish.yml. If a tag already exists, use the next version number.


License

MIT — see LICENSE.

Official Click API reference: docs.click.uz.

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

django_click_uz-0.1.1.tar.gz (24.3 kB view details)

Uploaded Source

Built Distribution

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

django_click_uz-0.1.1-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

Details for the file django_click_uz-0.1.1.tar.gz.

File metadata

  • Download URL: django_click_uz-0.1.1.tar.gz
  • Upload date:
  • Size: 24.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_click_uz-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9c347f5b9847198819941b6c2f8ab785b6709bf6d220653413945ee2f02b5e07
MD5 8e1e80fe9d014863310fb41c6302b0c0
BLAKE2b-256 e5f38f14784811af126dc5cd646b3aa1ff903f8b9d92fba4a9293c9d404698ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_click_uz-0.1.1.tar.gz:

Publisher: publish.yml on Matnazar-Matnazarov/django-click-uz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_click_uz-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_click_uz-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2c6220a951118d00be8b5a8bdded99f015d0b28be28efbcf2cf777101d7a3ae2
MD5 853858da2d3c165615cdec866d2ba804
BLAKE2b-256 0f9b7b071aef42c4034754f47233f09e4bf3ea4695b06874455bf432c6f89b82

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_click_uz-0.1.1-py3-none-any.whl:

Publisher: publish.yml on Matnazar-Matnazarov/django-click-uz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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