A Django app for integrating payments with multiple gateways. Currently supports integration with [Gateway 1] and [Gateway 2].
- Easy integration with multiple payment gateways
- Automated payment status tracking
- Customizable payment form
- Support for multiple currencies
Install the package using pip:
pip install django-payment-integrator
Add payment_integrator
to your INSTALLED_APPS
in settings.py
:
INSTALLED_APPS = [
...
'payment_integrator',
]
Run the migrations to create the necessary database tables:
python manage.py migrate
To configure the payment integrator, add the following to your settings.py
:
PAYMENT_INTEGRATOR = {
'GATEWAY_1': {
'API_KEY': '[api_key]',
'API_SECRET': '[api_secret]',
},
'GATEWAY_2': {
'API_KEY': '[api_key]',
'API_SECRET': '[api_secret]',
},
}
To use the payment integrator, you will need to create a payment form and process the payment using the provided functions.
from payment_integrator.forms import PaymentForm
from payment_integrator.utils import process_payment
# Create the payment form
form = PaymentForm(request.POST or None)
if form.is_valid():
# Process the payment
result = process_payment(form.cleaned_data, gateway='GATEWAY_1')
if result['status'] == 'success':
# Payment successful
else:
# Payment failed
For more information on the available functions and options, see the documentation.
For full documentation, see https://django-payment-integrator.readthedocs.io/.