Skip to main content

A reusable Django app for integrating with the Sentoo payment gateway.

Project description

Django Sentoo (djsentoo)

PyPI version License: MIT

A Django app for integrating with the Sentoo payment gateway.

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.wrapper import PaymentWrapper

# Create a payment
payment = PaymentWrapper()
response = payment.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

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

djsentoo-0.1.1.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

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

djsentoo-0.1.1-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: djsentoo-0.1.1.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.5

File hashes

Hashes for djsentoo-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9b477fbc24cfb45a6fdb1e7ee335de14ebed84b03f5e8160da07d05a050a1514
MD5 48c315f938d94e394508e8f3631cbaea
BLAKE2b-256 f0f9664fbd2bb2382647e0ae3a447b4829821cb589d9e1c742feee8fa48d884d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: djsentoo-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.5

File hashes

Hashes for djsentoo-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 64fd8df77d84aaa143c723487ea1fc43941327e571b1412b8694068de6f084da
MD5 ace378486a6d32697697413a73d79fce
BLAKE2b-256 5fc43e6d2bebe8e4c94d8de9f68b21d04a21470af0c488e1a49a76be02b8186e

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