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.0.tar.gz (25.4 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.0-py3-none-any.whl (35.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tarxemo_django_clickpesa-0.1.0.tar.gz
  • Upload date:
  • Size: 25.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for tarxemo_django_clickpesa-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c26531c6198050896e66d4b490f5d6b06a7a72a5a4c0d9abd9b3fbee5a5aad14
MD5 7e18f63a1dde32c8a174b39207769df2
BLAKE2b-256 cee8754d6eccdebbb9d578fccc85eaa6f450cb875ffb0a605c2f97bccff0734c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tarxemo_django_clickpesa-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f310cfe6f195e3f5116a0e9b8dc878a4f8eebaa2cbebc7aea837291c9db4b5b
MD5 66a67692371ba48c47d646f40db0144b
BLAKE2b-256 f2b944d8346d01017422821ea9e12ac8c9095dd6edd402ed7b446b2d3511c34b

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