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.

Metadata

Release files for django-getpaid 2.1.0rc1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-getpaid 2.1.0rc1
File Size Uploaded
django-getpaid-2.1.0rc1.tar.gz 21.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-getpaid 2.1.0rc1
File Interpreter ABI Platform
django_getpaid-2.1.0rc1-py3-none-any.whl Python 3 none any Details

Total release size: 45.6 kB

Release files / django-getpaid-2.1.0rc1.tar.gz

Download URL django-getpaid-2.1.0rc1.tar.gz
Size 21.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d039031615842d91fcf11a1fbfb6e0d031055f15c0dcb2dcebec20fa6b859c0d
BLAKE2b-256 checksum
How to use checksums
c4f326f05f7e57266b2c6a665da6b2b1d00f965b45e3b355a10dc7b3c3751624
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.8.2 Linux/5.6.5-3-MANJARO

Release files / django_getpaid-2.1.0rc1-py3-none-any.whl

Download URL django_getpaid-2.1.0rc1-py3-none-any.whl
Size 24.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2af06dbd06eb15060b88f09696478dbc89dd0f3d974617a4e07ead34095c157f
BLAKE2b-256 checksum
How to use checksums
52126061915fc70ae3f9e542139d31b8099b3687b9b09c801a9390b4a383d048
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.8.2 Linux/5.6.5-3-MANJARO

Release history Release notifications | RSS feed

3.2.0

2 release files

3.1.0

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.3.0

2 release files

2.2.2

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.0

2 release files

This release

2.1.0rc1 This release

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.8.0.1

1 release file

1.8.0

2 release files

1.7.6

1 release file

1.7.3

1 release file

1.7.2

2 release files

1.6.0

1 release file

1.5.1

1 release file

1.5.0

1 release file

1.4.0

1 release file

1.3.0

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1

1 release file

1.0.1

1 release file

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page