Skip to main content

Build status Code health Python versions Requirements Status Software license PyPI downloads

Simple django integration for API “Оплата Частями в Интернете”: Схема взаимодействия №1 (Создание платежа по сервису Оплата частями/Мгновенная рассрочка).

Installation

Install with pip:

$ pip install django-ok-payparts

Update INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    'payparts',
    ...
]

Add payparts.urls to your project urlpatterns:

urlpatterns = [
    ...
    path('', include('payparts.urls')),
    ...
]

Make migrations:

$ python manage.py migrate

Available settings

PAYPARTS_API_PASSWORD - Password of your store.

PAYPARTS_API_STORE_ID - Your store’s ID.

PAYPARTS_API_URL - Url for creation of a payment. By default: https://payparts2.privatbank.ua/ipp/v2/.

PAYPARTS_API_REDIRECT_URL - Url to redirect after a success payment. By default: https://payparts2.privatbank.ua/ipp/v2/payment.

Usage

How to create a payment

  1. Prepare your order’s data:

data = {
    "order_id": f"order-123",
    "amount": 400.00,
    "parts_count": 2,  # optional, default value is '2'
    "merchant_type": "II",  # optional, default value is 'II'
    "products": [
        {
            "name": "Телевизор",
            "count": 2,
            "price": 100.00
        },
        {
            "name": "Микроволновка",
            "count": 1,
            "price": 200.00
        }
    ],
    # also optional fields (can be set in your cabinet):
    "response_url": "http://shop.com/response",
    "redirect_url": "http://shop.com/redirect",
}
  1. Get your redirect url:

from payparts.use_cases import GetRedirectUrlUseCase
redirect_url = GetRedirectUrlUseCase().execute(data)
  1. Redirect a user to the url.

How to process a callback

Whenever a callback is processed a signal will be sent with the result of the transaction.

There are two signals (payparts.signals):

  1. pay_parts_success_callback - if signature is valid.

  2. pay_parts_invalid_callback - if signature is not valid.

Connect the signals to actions to perform the needed operations when a successful payment is received:

from payparts.signals import pay_parts_success_callback, pay_parts_invalid_callback

from orders.models import Order


def success_callback(sender, log, request, **kwargs):
    # ensure success state
    if log.is_success:
        order = Order.objects.get(pk=log.order_id)
        order.set_success_payment_state()

pay_parts_success_callback.connect(success_callback)

Metadata

Release files for django-ok-payparts 0.4

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-ok-payparts 0.4
File Size Uploaded Provenance Actions
django-ok-payparts-0.4.tar.gz 13.9 kB Without provenance Details for django-ok-payparts-0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-ok-payparts 0.4
File Interpreter ABI Platform Actions
django_ok_payparts-0.4-py3-none-any.whl Python 3 none any Details for django_ok_payparts-0.4-py3-none-any.whl

Total release size: 33.3 kB

Release files / django-ok-payparts-0.4.tar.gz

Download URL django-ok-payparts-0.4.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
48cc6e4a858880a617cd464148049739c754ff4ced946c7a7a6e6ed9b59f0947
BLAKE2b-256 checksum
How to use checksums
ad716e1d8af65a37fccbbaa374df51daefdb3c24a9b6a3c8233d774e76c39ed0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0

Release files / django_ok_payparts-0.4-py3-none-any.whl

Download URL django_ok_payparts-0.4-py3-none-any.whl
Size 19.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
589e99175e4220bb3a3b4425d869298f298a74d9cce8287d2ea932cdd4c33e35
BLAKE2b-256 checksum
How to use checksums
12d2b941fa45e6cb4dbe1e7b42f566f631c7655b6114bfa55c147f26f862d928
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.0

Security for django-ok-payparts 0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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