Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Latest PyPI version https://img.shields.io/travis/sunscrapers/django-getpaid.svg https://api.codacy.com/project/badge/Coverage/d25ba81e2e4740d6aac356f4ac90b16d https://img.shields.io/pypi/wheel/django-getpaid.svg https://img.shields.io/pypi/l/django-getpaid.svg https://api.codacy.com/project/badge/Grade/d25ba81e2e4740d6aac356f4ac90b16d

Welcome to django-getpaid

django-getpaid is payment processing framework for Django

Documentation

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

Features

  • support for multiple payment brokers at the same time

  • very 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)

  • support for global and per-plugin validators

  • 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-payu

Add them to your INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    'getpaid',
    'getpaid_payu',  # one of plugins
    ...
]

Add getpaid to URL patterns:

urlpatterns = [
    ...
    path('payments/', include('getpaid.urls')),
    ...
]

Define an Order model by subclassing getpaid.models.AbstractOrder and define some required 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_buyer_info(self):
        return {"email": self.buyer.email}

    def get_currency(self):
        return "EUR"

    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_payu": {
        # take these from your merchant panel:
        "pos_id": 12345,
        "second_key": "91ae651578c5b5aa93f2d38a9be8ce11",
        "oauth_id": 12345,
        "oauth_secret": "12f071174cb7eb79d4aac5bc2f07563f",
    },
}

Write a view that will create the Payment.

An example view and its hookup to urls.py can look like this:

# orders/views.py
from getpaid.forms import PaymentMethodForm

class OrderView(DetailView):
    model = Order

    def get_context_data(self, **kwargs):
        context = super(OrderView, self).get_context_data(**kwargs)
        context["payment_form"] = PaymentMethodForm(
            initial={"order": self.object, "currency": self.object.currency}
        )
        return context

# main urls.py

urlpatterns = [
    # ...
    path("order/<int:pk>/", OrderView.as_view(), name="order_detail"),
]

You’ll also need a template (order_detail.html in this case) for this view. Here’s the important part:

<h2>Choose payment broker:</h2>
<form action="{% url 'getpaid:create-payment' %}" method="post">
    {% csrf_token %}
    {{ payment_form.as_p }}
    <input type="submit" value="Checkout">
</form>

Running Tests

poetry install
poetry run tox

Alternatives

Credits

Created by Krzysztof Dorosz. Redesigned and rewritten by Dominik Kozaczko.

Proudly sponsored by SUNSCRAPERS

Disclaimer

This project has nothing in common with getpaid plone project.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-getpaid-2.1.0rc2.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_getpaid-2.1.0rc2-py3-none-any.whl (24.6 kB view details)

Uploaded Python 3

File details

Details for the file django-getpaid-2.1.0rc2.tar.gz.

File metadata

  • Download URL: django-getpaid-2.1.0rc2.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.8.2 Linux/5.6.5-3-MANJARO

File hashes

Hashes for django-getpaid-2.1.0rc2.tar.gz
Algorithm Hash digest
SHA256 5da23b896786a8fab0609c0e729318c117fda934d2d8c0c65cb6777049e943a2
MD5 b8130edce9a34b2f396963b6cfdc27dc
BLAKE2b-256 e675fbcd198cd549a2ffc3b62785c1f628ed13d7ccc682f4c11ecee56263d4fb

See more details on using hashes here.

File details

Details for the file django_getpaid-2.1.0rc2-py3-none-any.whl.

File metadata

  • Download URL: django_getpaid-2.1.0rc2-py3-none-any.whl
  • Upload date:
  • Size: 24.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.8.2 Linux/5.6.5-3-MANJARO

File hashes

Hashes for django_getpaid-2.1.0rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 88128356ac4baef2dc79d27fbe8dc9d55b9fe8ed6ea58791299beba519026bc0
MD5 0c2a9a19e9d842facf0a5bfcd9107215
BLAKE2b-256 2c5574936001a5912a1ea19001b9c8053f50f2f7b395f31ac08a49aa13e53908

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page