A Django module for using https://www.payplug.com payment solution.
Project description
A Django module for using https://www.payplug.com payment solution.
Documentation
The full documentation is at https://payplug_dj.readthedocs.org.
Quickstart
Install payplug-dj:
pip install payplug_dj
Then use it in a project, add:
'payplug_dj'
to your INSTALLED_APPS and set your PAYPLUG_API_KEY in your settings.py:
PAYPLUG_API_KEY = 'sk_test_XXXXxxxXXXX'
To use it in your application views:
from payplug_dj.models import Payment
from payplug_dj.signals import payment_return
from payplug_dj.signals import payment_cancel
payment = Payment.objects.create(
email='mail@example.com,
firstname='Alexandre',
lastname='Norman',
amount=12.45,
currency='EUR',
template_return='myapp/payment_return.html',
template_cancel='myapp/payment_cancel.html',
)
payment.save()
payment.create_payment(
metadata={
'my_invoice_id': '2016-0002',
'my_client_id': 142,
}
)
payment_return.connect(PaymentOk)
payment_return.connect(PaymentCancelled)
def PaymentOk(sender, **kwargs):
request = kwargs.get("request")
payment = kwargs.get("payment")
metadata = payment.get_payplug_metadata()
# Set payment OK
if payment.state == 'P':
# Do something
pass
return
def PaymentCancelled(sender, **kwargs):
# Do something
return
payment.state could take one of this values:
‘C’: Canceled
‘P’: Paid
‘R’: Refund
‘W’: Wait for payment
Features
Allow to use Payplug payment solution from Django.
Running Tests
Does the code actually work?
source <YOURVIRTUALENV>/bin/activate (myenv) $ pip install -r requirements-test.txt (myenv) $ python runtests.py
Credits
Tools used in rendering this package:
History
0.1.0 (2016-02-01)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file payplug_dj-0.1.0.tar.gz.
File metadata
- Download URL: payplug_dj-0.1.0.tar.gz
- Upload date:
- Size: 20.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f7231aba423cd2104f89426c3106acbbfd5854faa53cfb49e5c50fdc880c4d8
|
|
| MD5 |
94ffd6ea30e1dfb9921c7192c3e988bd
|
|
| BLAKE2b-256 |
7e9e07b9fffde2d0d52591a3b830bddeae86dc3e9ebd57fadd26c178587558ff
|
File details
Details for the file payplug_dj-0.1.0-py2.py3-none-any.whl.
File metadata
- Download URL: payplug_dj-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c4c44de66424a1fa70c65472961d51bdaad33d70a19b1cf7d148598638862b9
|
|
| MD5 |
f202f70b9fc021af14f80bb76552956e
|
|
| BLAKE2b-256 |
0fbaf28b38913d8a0af2cdb8a751e48cf4eed51fbee82bf5944c6c0e231c7993
|