Skip to main content

Click-SDK for Python

Project description

Click Software Development Kit

Installation

pip install click-sdk

Installation to Django

Add 'click_up' in to your settings.py

INSTALLED_APPS = [
    ...
    'click_up',
    ...
]

Add 'click_up' credentials inside to settings.py

Click configuration settings.py

CLICK_SERVICE_ID = "your-service-id"
CLICK_MERCHANT_ID = "your-merchant-id"
CLICK_SECRET_KEY = "your-secret-key"
CLICK_ACCOUNT_MODEL = "order.models.Order"  # your order model path.
CLICK_AMOUNT_FIELD = "amount"  # your amount field that's belongs to your order model

Create a new View that about handling call backs

from click_up.views import ClickWebhook


class ClickWebhookAPIView(ClickWebhook):
    def successfully_payment(self, params):
        """
        successfully payment method process you can ovveride it
        """
        print(f"payment successful params: {params}")

    def cancelled_payment(self, params):
        """
        cancelled payment method process you can ovveride it
        """
        print(f"payment cancelled params: {params}")

Add a payme path to core of urlpatterns:

from django.urls import path
from django.urls import include

from your_app.views import ClickWebhookAPIView

urlpatterns = [
    ...
    path("payment/click/update/", ClickWebhookAPIView.as_view()),
    ...
]

Run migrations

python3 manage.py makemigrations && python manage.py migrate

🎉 Congratulations you have been integrated click with django, keep reading docs. After successfull migrations check your admin panel and see results what happened.

Generate Pay Link

Example to generate link:

  • Input
from click_up import ClickUp

click_up = ClickUp(service_id="your-service-id",
                   merchant_id="your-merchant-id")  # alternatively you can use settings variables as well here.

# Generate Paylik payment link
paylink = click_up.initializer.generate_pay_link(
    id=1,  # id maybe order_id or acount_id (user_id, chat_id and etc..)
    amount=100,
    return_url="https://example.com"
)
  • Output
https://my.click.uz/services/pay?service_id=service_id&merchant_id=merchant_id&amount=1000&transaction_param=1&return_url=https://example.com

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

click_sdk-0.1.1.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

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

click_sdk-0.1.1-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: click_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for click_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 dbb4cf72d141addfb82da7237d04e4f2f50add285a5f16415c0786cc9e85ee9b
MD5 4c17f8e3f9f690f2d376876e5a87eb5c
BLAKE2b-256 26f9f8abf75cb907a0e5df06b3c2e2fadabd2c0ded32239e418a2b2b849fd7a3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: click_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for click_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c6757b06ad0a4149a18c5b1a2e345544753e9d411442acfe30f14108d9aebafb
MD5 a6b3522e09cff97550c69aaed24618a6
BLAKE2b-256 58b63d0e191fd72f94c8ecf2bfb80738bf8b34538ee17c1b8abe9f3feb3dfed6

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