Skip to main content

PaymentExpress PxPay Gateway for Django

Project description

PaymentExpress PxPay Gateway for Django


pip install django-pxpay or easy_install django-pxpay


You’ll need to add a few items in your PXPAY_USERID, PXPAY_KEY and, optionally, PXPAY_CURRENCY.

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(
        AmountInput='%.2f' % amount,
        CurrencyInput='AUD',  # Alternatively, can be provided in
        MerchantReference='Some reference')

    # Send payment request.
    response = Gateway().process_transaction(

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

    # Show error.
        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(

        # Show payment result.
        return payment_result(

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

def payment_result(request, success, msg):
    return render_to_response(
        {'success': success, 'msg': msg},

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-pxpay, version 0.2.6
Filename, size File type Python version Upload date Hashes
Filename, size django-pxpay-0.2.6.tar.gz (5.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page