payplug-dj 0.1.0

Last updated:

0 purchases

payplug-dj 0.1.0 Image
payplug-dj 0.1.0 Images
Add to Cart

Description:

payplugdj 0.1.0

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='[email protected],
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:

Cookiecutter
cookiecutter-djangopackage



History
0.1.0 (2016-02-01)

First release on PyPI.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.