Skip to main content

A Django library for integrating ClickPesa mobile money and payout services

Project description

tarxemo-django-clickpesa

A clean, service-oriented Django implementation for integrating ClickPesa payment and payout services.

Features

  • Mobile Money Payments: Initiate USSD push payments.
  • Payouts: Manage B2C and B2B payouts via mobile money or bank transfer.
  • Status Tracking: Orchestrate transaction lifecycles with local database records.
  • Django Signals: Decoupled event system to notify your app of status changes (Success, Failed, etc.).
  • Automatic Authentication: Token management and caching built-in.
  • Webhooks Support: Ready-to-use callback views with checksum verification.

Installation

pip install tarxemo-django-clickpesa

Configuration

Add clickpesa to your INSTALLED_APPS:

INSTALLED_APPS = [
    # ...
    'clickpesa',
]

Configure your ClickPesa credentials in settings.py:

CLICKPESA_API_BASE_URL = 'https://api.clickpesa.com' # Use sandbox for testing
CLICKPESA_API_KEY = 'your-api-key'
CLICKPESA_CLIENT_ID = 'your-client-id'
CLICKPESA_CHECKSUM_SECRET = 'your-webhook-secret'

Usage

Initiate a Payment

from clickpesa.managers.payment_manager import PaymentManager

manager = PaymentManager()
payment = manager.create_payment(
    amount=1000.0,
    phone_number="255712345678",
    order_reference="ORDER-123",
    currency="TZS"
)

Listening for Status Changes

from django.dispatch import receiver
from clickpesa.signals import payment_status_changed

@receiver(payment_status_changed)
def handle_payment_update(sender, instance, new_status, **kwargs):
    if new_status == 'SUCCESS':
        # Ship items, enroll user, etc.
        pass

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

tarxemo_django_clickpesa-0.1.1.tar.gz (25.3 kB view details)

Uploaded Source

Built Distribution

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

tarxemo_django_clickpesa-0.1.1-py3-none-any.whl (35.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tarxemo_django_clickpesa-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b22d0092c42dd009eb460d37e8379ec4f4c6676f77b715f648d134f9b37020df
MD5 b33e2dc4306969ab8b9cf00ee9689f63
BLAKE2b-256 c6dafc7acfcff59c11dd877fa46d4a67e9407e8e55dd0a1fdd439fa25c9fdbbf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tarxemo_django_clickpesa-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 932570a1096c3cd6708a557935f7dd8efad3a0bf0d6639b1dca7fbce010cb1e4
MD5 57c973bd511cd524c7e714bd268a0831
BLAKE2b-256 883b21dae75f0795a2146da67d4d10256f46160f0dab951eae1bd92f7e11f5d2

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