Package: django-pesapal
A django port of pesapal payment gatewayDocumentationThe full documentation is athttps://django-pesapal.readthedocs.org.QuickstartInstall django-pesapal:pip install django-pesapalThen use it in a project:import django_pesapalAdddjango_pesapalto yourINSTALLED_APPSsetting like this:INSTALLED_APPS = (
    ...
    'django_pesapal',
)Include thedjango_pesapalURLconf in your project urls.py like this:url(r'^payments/', include('django_pesapal.urls')),You can set your own return url by adding this tosettings.py:PESAPAL_TRANSACTION_DEFAULT_REDIRECT_URL = 'app_name:url_name'  # this needs to be a reversibleRunpython manage.py migrateto create the models.Create a method that receives payment details and returns the pesapal iframe url:from django_pesapal.views import PaymentRequestMixin

class PaymentView(PaymentRequestMixin, TemplateView):

    def get_pesapal_payment_iframe(self):

        '''
        Authenticates with pesapal to get the payment iframe src
        '''
        order_info = {
            'first_name': 'Some',
            'last_name': 'User',
            'amount': 100,
            'description': 'Payment for X',
            'reference': 2,  # some object id
            'email': 'user@example.com',
        }

        iframe_src_url = self.get_payment_url(**order_info)
        return iframe_src_urlOnce payment has been processed, you will be redirected to an intermediate screen where the user can finish ordering. Clicking the “Finish Ordering” button will check the payment status to ensure that the payment was successful and then redirects the user toPESAPAL_TRANSACTION_DEFAULT_REDIRECT_URL.ConfigurationSettingDefault ValuePESAPAL_DEMOTruePESAPAL_CONSUMER_KEY‘’PESAPAL_CONSUMER_SECRET‘’PESAPAL_IFRAME_LINK (if PESAPAL_DEMO=True)‘http://demo.pesapal.com/api/PostPesapalDirectOrderV4’PESAPAL_IFRAME_LINK (if PESAPAL_DEMO=False)‘https://www.pesapal.com/api/PostPesapalDirectOrderV4’PESAPAL_QUERY_STATUS_LINK (Demo Mode=True)‘http://demo.pesapal.com/API/QueryPaymentDetails’PESAPAL_QUERY_STATUS_LINK (Demo Mode=False)‘https://www.pesapal.com/API/QueryPaymentDetails’PESAPAL_OAUTH_CALLBACK_URL‘transaction_completed’PESAPAL_OAUTH_SIGNATURE_METHOD‘SignatureMethod_HMAC_SHA1’PESAPAL_TRANSACTION_DEFAULT_REDIRECT_URL‘/’PESAPAL_TRANSACTION_FAILED_REDIRECT_URL‘’PESAPAL_REDIRECT_WITH_REFERENCETruePESAPAL_TRANSACTION_MODEL‘django_pesapal.Transaction’History1.3.3 (2023-01-26)Bug fix: Handling invalid data1.3.2 (2022-01-21)Support for Django 3.9Update dependenciesSupport Py38, Py39Remove EOL py271.3.1 (2019-07-16)Update dependenciesSupport Py37Remove EOL py341.3.0 (2018-09-29)Support for Django 2.1Support Py361.2.0 (2016-12-11)Dropped support for Django 1.7Fixes and Upgrades to support Django 1.8 - 1.10Use Django’s UUIDField1.1.0 (2016-05-03)Support Django 1.9Update payment_method field length from 16 to 24Remove support for Py33. Support Py351.0.1 (2015-11-21)Fix querydict bug1.0.0 (2015-11-11)Support Django 1.8Support Py33 and Py34Return proper IPN response0.3.4 (2015-08-12)Restructure flow to better support IPN processing0.3.3 (2015-06-29)Setup build had not packaged the templates0.3.2 (2015-06-13)Fix documentation formatting issues0.3.1 (2015-06-13)Allow specifying own transaction modelPass all transaction info when redirectingUpdate intermediate template0.3 (2015-06-12)Introduce intermediate payment processing screenUpdate Django version to 1.7+Add support to receive and process IPNSave all details about the transaction and status0.2.1 (2015-04-03)Added test sandboxUpdated Django versionUpdated django-uuidfield0.2 (2015-03-17)Support anonymous checkoutsAdd support for getting payment statusMajor structural refactoring. Use mixinsUse Mixins and XML Builder0.1.5 (2014-09-25)Pin dependencies to specific versionsUpdate how imports should be doneRemove imports from __init__.py0.1.4 (2014-09-23)Fix import bug. Tests for projects using this fail in ShippableSet max Django version to 1.70.1.3 (2014-07-18)Packaging for PyPi0.1.2 (2014-06-30)Fix import bug in urls.pyFix how callback url is constructedFix: Live URL uses https0.1.1 (2014-06-30)Refactor handling of redirect urls. Model validation of transaction and merchant referenceRename settings to conf. Set default oauth redirect urlAdd django-uuidfield to dependencies0.1.0 (2014-06-30)First release on PyPI.