Metadata-Version: 2.5
Name: entirius-django-checkout
Version: 10.0.0
Summary: Checkout engine for Entirius: carts, orders, payment gateways, shipping, discounts and sale offers
Project-URL: Homepage, https://docs.entirius.com/
Project-URL: Documentation, https://github.com/entirius/entirius-django-checkout/tree/develop/docs
Project-URL: Repository, https://github.com/entirius/entirius-django-checkout
Project-URL: Changelog, https://github.com/entirius/entirius-django-checkout/blob/develop/CHANGELOG.md
Project-URL: Issues, https://github.com/entirius/entirius-django-checkout/issues
Author: Entirius
Maintainer: Piotr Brzozowski, Paweł Kiełt, Mateusz Baran, Michał Kloczkowski
License-Expression: MPL-2.0
License-File: LICENSE
Keywords: cart,checkout,django,ecommerce,entirius,orders,payments
Classifier: Development Status :: 5 - Production/Stable
Classifier: Framework :: Django
Classifier: Framework :: Django :: 5.2
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Office/Business
Requires-Python: >=3.11
Requires-Dist: celery
Requires-Dist: defusedxml>=0.7.1
Requires-Dist: django-admin-inline-paginator>=0.3.0
Requires-Dist: django-filter>=23.0
Requires-Dist: django>=5.0
Requires-Dist: djangorestframework-simplejwt>=5.3
Requires-Dist: djangorestframework>=3.14
Requires-Dist: drf-spectacular>=0.27
Requires-Dist: entirius-django-accounts>=5.0.0
Requires-Dist: entirius-django-pim>=3.1.0
Requires-Dist: entirius-django-pricemanager>=4.1.0
Requires-Dist: entirius-django-regional>=2.0.0
Requires-Dist: entirius-django-utils>=2.0.0
Requires-Dist: entirius-py-autopay-sdk>=2.0.0
Requires-Dist: entirius-py-bievents>=2.0.0
Requires-Dist: entirius-py-idx-normalizator>=2.0.0
Requires-Dist: entirius-py-paynow-sdk>=2.0.0
Requires-Dist: entirius-py-paypal-sdk>=2.0.0
Requires-Dist: entirius-py-payu-sdk>=2.0.0
Requires-Dist: entirius-py-process-logger>=2.0.0
Requires-Dist: entirius-py-przelewy24-sdk>=2.0.0
Requires-Dist: marshmallow
Requires-Dist: marshmallow-dataclass
Requires-Dist: pandas>=2.0
Requires-Dist: pydantic>=2.0
Requires-Dist: pytz
Requires-Dist: stripe>=11.6.0
Requires-Dist: tqdm
Provides-Extra: dev
Requires-Dist: pre-commit; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Provides-Extra: qms
Requires-Dist: entirius-django-qms>=4.0.0; extra == 'qms'
Provides-Extra: returns
Requires-Dist: entirius-django-returns>=3.0.0; extra == 'returns'
Provides-Extra: test
Requires-Dist: dj-database-url; extra == 'test'
Requires-Dist: entirius-django-captcha>=2.0.0; extra == 'test'
Requires-Dist: psycopg[binary]; extra == 'test'
Requires-Dist: pytest; extra == 'test'
Requires-Dist: pytest-django; extra == 'test'
Provides-Extra: vault
Requires-Dist: entirius-django-vault>=2.0.0; extra == 'vault'
Description-Content-Type: text/markdown

# entirius-django-checkout

A Django module for carts and orders in Entirius, the open-source modular ecommerce platform. It runs the checkout
of a multi-channel storefront: cart lifecycle, order creation and splitting, payments through pluggable gateways,
shipping and payment method selection, discounts and stock reservation.

[![PyPI](https://img.shields.io/pypi/v/entirius-django-checkout.svg)](https://pypi.org/project/entirius-django-checkout/)
[![Python](https://img.shields.io/pypi/pyversions/entirius-django-checkout.svg)](https://pypi.org/project/entirius-django-checkout/)
[![License: MPL-2.0](https://img.shields.io/badge/license-MPL--2.0-blue.svg)](https://github.com/entirius/entirius-django-checkout/blob/develop/LICENSE)

## What it does

- Keeps carts and turns them into orders, with order splitting by configurable rules.
- Takes payments through PayU, PayPal, Autopay, Przelewy24, Paynow and Stripe, including their notification
  callbacks.
- Offers shipping and payment methods per sales channel, country and currency.
- Applies discount codes, discount rules and free-product (gratis) rules.
- Reserves stock per product and supplier.
- Exposes two REST API generations side by side: v1 and v2, where each PATCH updates one part of the cart.

## Installation

```shell
uv add entirius-django-checkout
pip install entirius-django-checkout
```

Optional integrations are extras (`qms`: stock sync from warehouses, `vault`: saved payment cards, `returns`:
order returns):

```shell
uv add "entirius-django-checkout[qms,vault,returns]"
```

```python
INSTALLED_APPS = [
    ...
    "django_utils",
    "django_regional",
    "django_accounts",
    "django_pim",
    "django_pricemanager",
    "django_checkout",
]

# The list works first in, first out: the first entry is checked first.
AUTHENTICATION_BACKENDS = [
    "django_accounts.backends.JWTAccessBackend",
    "django.contrib.auth.backends.ModelBackend",  # default Django auth, needed for /admin
]

# urls.py
urlpatterns = [
    path("", include("django_checkout.urls")),
]
```

Required settings: `PRIVATE_DIR`, `EXPORT_DIR`, `BI_ENVIRONMENT` and `BI_BUSINESS_UNIT`; the module refuses to
import without them. Reference with the optional toggles:
https://github.com/entirius/entirius-django-checkout/blob/develop/docs/configuration.md.

The storefront API reads its key from the `X-API-KEY` header. With `django_access` installed the key is an access
token: scope `checkout.storefront` for the storefront key, `checkout.erase` for the admin erase key (which also
needs `--expires-days <days>`):

```shell
python manage.py access_token create --application <name> --create-application --scope checkout.storefront --channel <idx>
```

Without `django_access`, create the keys with `python manage.py generate-api-key <channel_idx>` and
`python manage.py generate-api-admin-key <channel_idx>`.

## Quick start

```python
from django_checkout.models import Channel
from django_checkout.services.cart_service import get_cart

channel = Channel.objects.get(idx="default")
cart = get_cart(channel, cart_id)
```

## Requirements

- Python 3.11 or newer, Django 5.0 or newer.
- PostgreSQL.
- Entirius packages pulled in: `entirius-django-utils`, `entirius-django-regional`, `entirius-django-pim`,
  `entirius-django-accounts`, `entirius-django-pricemanager`, the payment gateway SDKs (`entirius-py-payu-sdk`,
  `entirius-py-paypal-sdk`, `entirius-py-autopay-sdk`, `entirius-py-przelewy24-sdk`, `entirius-py-paynow-sdk`),
  `entirius-py-bievents`, `entirius-py-idx-normalizator`, `entirius-py-process-logger`.

## Documentation

- Module docs: https://github.com/entirius/entirius-django-checkout/tree/develop/docs
- Entirius documentation: https://docs.entirius.com/
- Changelog: https://github.com/entirius/entirius-django-checkout/blob/develop/CHANGELOG.md

## Part of Entirius

This module runs inside the Entirius backend service (Volkanos), next to the catalog, price and account modules.

- Backend service: https://github.com/entirius/entirius-service-volkanos
- Docker harness: https://github.com/entirius/entirius-zeno
- Sibling modules: https://github.com/entirius/entirius-django-pricemanager,
  https://github.com/entirius/entirius-django-accounts, https://github.com/entirius/entirius-django-returns,
  https://github.com/entirius/entirius-django-vault, https://github.com/entirius/entirius-django-qms

## Development

```shell
make install     # sync dependencies (uv)
make check       # lint + format check (ruff)
make test        # test suite (pytest + pytest-django, needs PostgreSQL via DATABASE_URL)
```

Development and agent instructions: https://github.com/entirius/entirius-django-checkout/blob/develop/AGENTS.md

## License

Mozilla Public License 2.0 (MPL-2.0) — see https://github.com/entirius/entirius-django-checkout/blob/develop/LICENSE.
