PayU payments provider for django-payments
Project description
PayU payments provider for django-payments
Documentation
The full documentation is at https://django-payments-payu.readthedocs.io.
Quickstart
Install django-payments and set up PayU payment provider backend according to django-payments documentation:
Example:
# use sandbox PAYMENT_VARIANTS = { 'payu': ('payments_payu.provider.PayuProvider', { 'pos_id': '123456', 'second_key': 'iseedeadpeople', 'client_secret': 'peopleiseedead', 'sandbox': True, 'capture': False, }), }
Additional settings:
PayU requires users first name, last name and email. Override ether get_user or get_user_email, get_user_first_name and get_user_last_name methods from BasePayment.
Recurring payments:
If recurring payments are enabled, the PayU card token needs to be stored in your application for usage in next payments. The next payments can be either initiated by user through (user will be prompted only for payment confirmation by the express form) or by server. To enable recurring payments, you will need to set additional things:
In order to make payments recurring, the card token needs to be stored for the Payment’s user (not just the payment itself). Implement the Payment.set_renew_token() and Payment.get_renew_token().
Implement Payment.get_payment_url().
- For the server initiated recurring payments you will need to create the new payment and then call payment.auto_complete_recurring().
The method returns either string ‘success’ or url where the user can provide his CVV2 or 3D secure information.
The 'success' string means, that the payment is waiting for notification from PayU, but no further user action is required.
Example of triggering recurring payment:
payment = Payment.objects.create(...) redirect_url = payment.auto_complete_recurring() if redirect_url != 'success': send_mail( 'Recurring payment - action required', 'Please renew your CVV2/3DS at %s' % redirect_url, 'noreply@test.com', [user.email], fail_silently=False, )
Running Tests
Does the code actually work?
source <YOURVIRTUALENV>/bin/activate (myenv) $ pip install tox (myenv) $ tox
Credits
Tools used in rendering this package:
History
0.1.0 (2020-04-06)
First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for django-payments-payu-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7f74c99e13e8ef574b72499d540ae9e499084a10f432071b565393858ea281a |
|
MD5 | 37a7cea23a3820939ed847d0adf0781d |
|
BLAKE2b-256 | 73bf6414c933412e9c26ad27e5f2e644a69e468ab2ac3a9b7c263faf4498b08d |