Skip to main content

Django Sentoo (djsentoo)

PyPI version License: MIT

An unofficial Django app for integrating with the Sentoo payment gateway.

Note: This project is not officially supported by Sentoo.

Overview

djsentoo is a Django reusable application that provides seamless integration with the Sentoo payment gateway service. This library simplifies the process of accepting payments, tracking transaction statuses, and handling webhook callbacks from the Sentoo payment platform.

Features

  • Simple API for creating payment transactions
  • Automatic tracking of transaction status
  • Webhook handling for payment status updates
  • Support for multiple currencies
  • QR code payment support
  • Django admin integration

Quick Start

1. Install the package

pip install djsentoo

2. Add to INSTALLED_APPS

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

3. Configure settings

# settings.py
SENTOO = {
    'SECRET': os.getenv('SENTOO_SECRET'),
    'MERCHANT_ID': os.getenv('SENTOO_MERCHANT_ID'),
    'SANDBOX': True,  # Set to False for production
    'DEFAULT_CURRENCY': 'USD',
}

4. Include URLs

# urls.py
urlpatterns = [
    # ...
    path('sentoo/', include('djsentoo.urls', namespace='djsentoo')),
    # ...
]

5. Run migrations

python manage.py migrate djsentoo

Basic Usage

Creating a payment

from djsentoo.service import SentooPaymentService

# Create a payment
service = SentooPaymentService()
response = service.create_payment(
    amount=5000,  # 50.00 in cents
    currency='USD',
    description='Payment for Order #12345',
    return_url='https://example.com/payment/return/',
    customer='customer@example.com'  # Optional
)

# Redirect to payment page
redirect(response.url)

# Or use QR code
qr_code_url = response.qr_code_url

# Store transaction ID for later reference
transaction_id = response.transaction_id

Handling webhooks

from django.dispatch import receiver
from djsentoo.signals import sentoo_transaction_status_changed
from djsentoo.models import TransactionStatusChoices

@receiver(sentoo_transaction_status_changed)
def handle_payment_update(sender, transaction, **kwargs):
    if transaction.status == TransactionStatusChoices.SUCCESS:
        # Handle successful payment
        order = Order.objects.get(payment_id=transaction.transaction_id)
        order.mark_as_paid()
        
    elif transaction.status == TransactionStatusChoices.FAILED:
        # Handle failed payment
        notify_customer_about_failed_payment(transaction)

Documentation

For detailed documentation, see the full documentation.

Support

If you encounter any issues or have questions, please open an issue on GitHub.

License

MIT License

Metadata

Release files for djsentoo 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for djsentoo 0.2.2
File Size Uploaded
djsentoo-0.2.2.tar.gz 20.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for djsentoo 0.2.2
File Interpreter ABI Platform
djsentoo-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 30.6 kB

Release files / djsentoo-0.2.2.tar.gz

Download URL djsentoo-0.2.2.tar.gz
Size 20.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d1909e80309b51928da099344f5bdc9d5a5bebd64638e71b6084e2a182d2813a
BLAKE2b-256 checksum
How to use checksums
682cf3a4ec50a01d8cb25f0e1e946840a2661fee6b8a0148ba15302bf82e0cd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.17

Release files / djsentoo-0.2.2-py3-none-any.whl

Download URL djsentoo-0.2.2-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e92d4bd5452cecbcd60a947235582163a29b51d3a3f85e95d1fe1ed5a1e7b028
BLAKE2b-256 checksum
How to use checksums
84eb024feb6ba88724aa794cd00eff88da7fd6f8f0de09b7b91ce21af77f03d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.8.17

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page