Package: django-payu-payments
InstallationInstall via pip:pip install django-payu-paymentsAddpayuto INSTALLED_APPS:INSTALLED_APPS = [
    ...
    'payu',
    ...
]Add URLs to URLConf:url(r'^payments/', include('payu.urls', namespace='payu')),Run migrations:python manage.py migrateConfigurationConfiguration is done via Django’ssettins.pyfile.PAYU_POS_IDYour POS ID. If not provided the test payment value will be used.PAYU_MD5_KEYYour MD5 key. If not provided the test payment value will be used.PAYU_SECOND_MD5_KEYYour second MD5 key. If not provided the test payment value will be used.PAYU_CONTINUE_PATHSpecifies path on your website, where user should be redirected after payment (successful, or not).
May be absolute path, like/some-page/orreverse('some:thing').
This view should handle GET parameterserror=501in case of failed payment andno_payment=1in case of payment with total equals 0, which is registered, but actually sent to PayU.PAYU_VALIDITY_TIMEPayment validity time (in seconds), after which it’s canceled, if user did not take action.
If not provided600will be used.Create paymentTo create payment object you have to callPayment.createmethod:from payu.models import Payment


description = 'Some stuff'
products = [
    {
        'name': 'Some product',
        'unitPrice': 14.99,
        'quantity': 1
    },
    {
        'name': 'Some other product',
        'unitPrice': 3.19,
        'quantity': 4
    }
]
buyer = {
    'email': 'john.doe@domain.com',
    'firstName': 'John',
    'lastName': 'Doe'
}
notes = 'This client is important for us, we should prioritize him.'

payment = Payment.create(request, description, products, buyer, validity_time=300, notes)requestis just Django HTTP request object, we need it to get buyer IP, and absolute URLs.validity_timeis optional and overridesPAYU_VALIDITY_TIMEsetting.notesis optional, and used for storing internal information about payment.Payment.createwill return two-key dictionary, containingPaymentobject and URL where buyer should be redirected, orFalseif not successful.{
    'object': <Payment object>,
    'redirect_url': 'https://...'
}Fetch payment’s dataTo get data associated with payment you just need to retrievePaymentobject:Payment.objects.get(...)There are also few helpful methods, which you can call onPaymentobject:get_total_display()Returns pretty formattedtotalvalue.get_products_table()Returns pretty formatted table of products associated with payment.is_successful()ForstatusequalCOMPLETEDreturnsTrue, otherwiseFalse.is_not_successful()ForstatusequalCANCELEDorREJECTEDreturnsTrue, otherwiseFalse.Changelog0.1.3PEP8 fixes0.1.2changelog addedget_total_display(),get_products_table(),is_successful()andis_not_successful()methods addedJSONField is not Postgres-only anymorePayment.create()now returns two-key dictionary instead of just redirect URLPaymentobjects are now ordered from newest to oldest, by defaultcompiled translation is now included in packagesettings moved tosettings.pysettings is not dictionary anymorevalidity time addedJSONField and ordering related changes requires you to take some action when upgrading.run migrations:python manage.py migrate payu.run following code, using Django shell (python manage.py shell):import json
from payu.models import Payment


for p in Payment.objects.all():
    if isinstance(p.products, str):
         p.products = json.loads(p.products)
         p.save()0.1.1sum added to products table0.1.0initial version