Multi-broker payment processor for Django.
Project description
django-getpaid is a multi-broker payment processor for Django
Documentation
The full documentation is at https://django-getpaid.readthedocs.io.
Features
support for multiple payment brokers at the same time
clean but flexible architecture
support for asynchronous status updates - both push and pull
support for modern REST-based broker APIs
support for multiple currencies (but one per payment)
easy customization with provided base abstract models and swappable mechanic (same as with Django’s User model)
Quickstart
Install django-getpaid and at least one payment backend:
pip install django-getpaid
pip install django-getpaid-paynow
Add them to your INSTALLED_APPS:
INSTALLED_APPS = [
...
'getpaid',
'getpaid_paynow', # one of plugins
...
]
Add getpaid to URL patterns:
urlpatterns = [
...
path('payments/', include('getpaid.urls')),
...
]
Use getpaid.models.AbstractOrder as parent class of your Order model and define minimal set of methods:
from getpaid.models import AbstractOrder
class MyCustomOrder(AbstractOrder):
amount = models.DecimalField(decimal_places=2, max_digits=8)
description = models.CharField(max_length=128)
buyer = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
def get_absolute_url(self):
return reverse('order-detail', kwargs={"pk": self.pk})
def get_total_amount(self):
return self.amount
def get_user_info(self):
return {"email": self.buyer.email}
def get_description(self):
return self.description
Inform getpaid of your Order model in settings.py and provide settings for payment backends:
GETPAID_ORDER_MODEL = 'yourapp.MyCustomOrder'
GETPAID_BACKEND_SETTINGS = {
'getpaid_paynow': { # dotted import path of the plugin
# refer to backend docs for its real settings
"api_key": "9bcdead5-b194-4eb5-a1d5-c1654572e624",
"signature_key": "54d22fdb-2a8b-4711-a2e9-0e69a2a91189",
},
}
And… provide some business logic ;)
Your pre-payment view should use getpaid.forms.PaymentMethodForm bound with payment data. During binding the form will generate a list of plugins (payment methods) supporting your currency and hide rest of the fields. Then this form should be POSTed to {% url 'getpaid:create-payment' %} to create new payment. You should be automatically redirected to paywall. After payment you should by default return to order-detail page but this behavior can be changed by plugin’s config.
Running Tests
Does the code actually work?
poetry install
poetry run tox
Credits
Created by Krzysztof Dorosz. Redesigned and rewritten by Dominik Kozaczko.
Proudly sponsored by SUNSCRAPERS
Tools used in rendering this package:
Disclaimer
This project has nothing in common with getpaid plone project.
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
Hashes for django_getpaid-2.0.0rc6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cc7c74edfc9b0b2f3f4d5a26f7e49115d28e9050286d3dd9aee9425f142ab96 |
|
MD5 | b44cf63b3603cb0ff84aa5a7a074f335 |
|
BLAKE2b-256 | 091b1ef81a62b8e26f25bb04be6755f8b927d9ec93b102a8a74f921a27ce0363 |