Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install django-pxpay

How to install django-pxpay

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install django-pxpay
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
Linux (32-bit)
0.2.6 Available View build log
Linux (64-bit)
0.2.6 Available View build log
 
Author
License
BSD
Dependencies
Imports
Lastest release
version 0.2.6 on Apr 3rd, 2013

PaymentExpress PxPay Gateway for Django

Installation:

pip install django-pxpay or easy_install django-pxpay

Usage:

You'll need to add a few items in your settings.py: PXPAY_USERID, PXPAY_KEY and, optionally, PXPAY_CURRENCY.

System Message: ERROR/3 (<string>, line 19)

Unknown directive type "code-block".

.. code-block:: python

        from django.shortcuts import redirect, render_to_response
        from django.template.context import RequestContext
        from django.http import Http404
        from pxpay.gateway import Gateway


        def payment(request, amount):
            # Create a transaction.
            txn = Gateway().transaction(
                TxnType='Purchase',
                AmountInput='%.2f' % amount,
                CurrencyInput='AUD',  # Alternatively, can be provided in settings.py
                MerchantReference='Some reference')

            # Send payment request.
            response = Gateway().process_transaction(
                txn,
                UrlFail=request.build_absolute_uri(reverse('process_payment')),
                UrlSuccess=request.build_absolute_uri(reverse('process_payment')))

            # Redirect to PaymentExpress hosted payment page.
            if response.is_valid:
                return redirect(response.get_data['URI'])

            # Show error.
            else:
                return payment_result(request, False, 'Invalid Transaction Request')


        def process_payment(request):
            # Proper PaymentExpress request would always have these.
            if 'result' in request.GET and 'userid' in request.GET:

                # Process PaymentExpress response.
                process_response = Gateway().process_response(
                    Response=request.GET['result'])

                # Show payment result.
                return payment_result(
                    request,
                    bool(int(process_response.get_data['Success'])),
                    process_response.get_data['ResponseText'])

            # Rise 404 if no required arguments were passed.
            raise Http404


        def payment_result(request, success, msg):
            return render_to_response(
                'payment.html',
                {'success': success, 'msg': msg},
                context_instance=RequestContext(request))

Subscribe to package updates

Last updated Apr 3rd, 2013

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.