PayU integration for Django.
Project description
Installation
Install via pip:
pip install django-payu-payments
Add payu to INSTALLED_APPS:
INSTALLED_APPS = [ ... 'payu', ... ]
Add URLs to URLConf:
url(r'^payments/', include('payu.urls', namespace='payu')),
Add following settings to your settings module:
PAYU = { 'test': True, 'pos_id': 'YOUR POS ID', 'md5_key': 'YOUR MD5 KEY', 'second_md5_key': 'YOUR SECOND MD5 KEY', 'continue_path': '/some-page/' }
Run migrations:
python manage.py migrate
Configuration
PAYU['test']
Enables PayU test channel, ignoring post_id, md5_key and second_md5_key.
PAYU['continue_path']
Specifies path on your website, where user should be redirected after payment (successful, or not). May be absolute path, like /some-page/ or reverse('some:thing').
Usage
To create payment object you have to call Payment.create method:
from payu 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, notes)
request is just Django HTTP request object, we need it to get buyer IP, and absolute URLs.
notes are optional, all other arguments are required.
Payment.create will return URL where buyer should be redirected, or False if not successful.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-payu-payments-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fcd098da5ec317793b641b6af2b7a50af53b63470177f0d7d1b54def9525c59 |
|
MD5 | 97a33f4bacff166ff68190d6c8484420 |
|
BLAKE2b-256 | 7d7accdea1bef131998aaa542db511e1b6f303c1c8d33e75e9bb85725202d392 |
Hashes for django_payu_payments-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 333c309901fb7c629a0fe727b2fb258dbab4f95c8e695da10ca2f06a62295679 |
|
MD5 | 087a38b138002a93b65226029443f912 |
|
BLAKE2b-256 | a9e04edea524f0ef39f7d0dde099937b076c7b06e61751dc2eece0f2db3a1090 |