/django-plans-payments

Integration between django-plans and django-payments

Primary LanguagePythonMIT LicenseMIT

Django plans payments

Almost automatic integration between django-plans and django-payments. This will add payment buttons to the order page and automatically confirm the Order after the payment. Optionally, it can return the corresponding order when a payment is refunded.

Documentation

The full documentation is at https://django-plans-payments.readthedocs.io.

Quickstart

Install and configure django-plans and django-payments apps. Capture mode is not yet supported, so PAYMENT_VARINANTS with 'capture': False will not get confirmed.

Install Django plans payments:

pip install django-plans-payments

Add it to your INSTALLED_APPS, before the plans:

INSTALLED_APPS = (
    ...
    'related_admin',
    'plans_payments',
    'plans',
    ...
)

Add Django plans_payments to the URL patterns:

urlpatterns = [
    ...
    url(r'^plans-payments', include('plans_payments.urls')),
    ...
]

Set django-plans settings and set model to:

PAYMENT_MODEL = 'plans_payments.Payment'

Customer IP address

Customer IP address is stored in Payment model and used for some payment providers (i.e. PayU). For security reasons django-plans-payments does acquire the IP only from request REMOTE_ADDR parameter. If you are behind proxy, you will need to setup some mechanism to populate this variable from HTTP_X_FORWARDED_FOR parameter. The suggested solution is to use django-httpforwardedfor or django-xff application for that.

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Credits

Tools used in rendering this package: