Skip to main content

djpg is a Django module that integrates with the online payment service PagSeguro.

Project description

djpg is a Django module that integrates with the online payment service PagSeguro.



$ pip install djpg


$ pip install -e git+


Creating a cart and redirecting the user

import djpg

def my_view(request):
    cart = djpg.Cart(reference='1234', redirect_url='')
    item = djpg.Item(id='1', description='Cool T-shirts!', amount=25.00, quantity=2)

    code = cart.checkout()
    if code:
        # This will redirect the user to PagSeguro's checkout page
        # so the cart can be paid, or canceled.
        return cart.proceed(code)

Receiving notifications

This snippet will ensure djpg receives notifications from PagSeguro and dispatch them to the respective signals. This endpoint needs to be configured in your PagSeguro’s account also, under “Notificações de Transações” (e.g.:

urlpatterns += patterns('',
    url(r'^pagseguro/', include('djpg.urls'))

Then you can connect listeners to the signals that are relevant to you.

from djpg.signals import transaction_paid

def on_paid(sender, **kwargs):
    transaction = kwargs.pop('transaction')
    ref = transaction['reference']
    info = transaction['anotherinfo']


The available signals are: - notification_received - transaction_received - transaction_waiting - transaction_analysis - transaction_paid - transaction_available - transaction_dispute - transaction_returned - transaction_canceled - transaction_unknown

Project details

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
djpg-0.1.1.tar.gz (4.0 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page