Metadata-Version: 2.4
Name: python-getpaid-core
Version: 0.1.0
Summary: Framework-agnostic payment processing core.
Project-URL: Homepage, https://github.com/django-getpaid/python-getpaid-core
Project-URL: Repository, https://github.com/django-getpaid/python-getpaid-core
Project-URL: Documentation, https://getpaid-core.readthedocs.io
Project-URL: Changelog, https://github.com/django-getpaid/python-getpaid-core/releases
Author-email: Dominik Kozaczko <dominik@kozaczko.info>
License: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Office/Business :: Financial
Classifier: Topic :: Office/Business :: Financial :: Point-Of-Sale
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: anyio>=4.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: transitions>=0.9.0
Description-Content-Type: text/markdown

# getpaid-core

[![PyPI](https://img.shields.io/pypi/v/python-getpaid-core.svg)](https://pypi.org/project/python-getpaid-core/)
[![Python Version](https://img.shields.io/pypi/pyversions/python-getpaid-core)](https://pypi.org/project/python-getpaid-core/)
[![License](https://img.shields.io/pypi/l/python-getpaid-core)](https://github.com/django-getpaid/python-getpaid-core/blob/main/LICENSE)

Framework-agnostic payment processing library for Python. Provides the core
abstractions — enums, protocols, FSM, processor base class, plugin registry,
and exception hierarchy — that framework-specific adapters build on.

## Architecture

getpaid-core defines the **what** of payment processing without coupling to
any web framework:

- **Enums** (`PaymentStatus`, `FraudStatus`, `BackendMethod`, `ConfirmationMethod`)
  define all valid states and methods.
- **Protocols** (`Payment`, `Order`, `PaymentRepository`) define structural
  contracts that framework models must satisfy.
- **FSM** (`create_payment_machine`, `create_fraud_machine`) attaches
  state-machine triggers to payment objects at runtime using the `transitions`
  library.
- **BaseProcessor** is an abstract class that payment gateway plugins subclass
  to implement `prepare_transaction`, `handle_callback`, `charge`, etc.
- **PluginRegistry** discovers and stores payment backend processors via
  entry points or manual registration.
- **Exceptions** provide a structured hierarchy for payment errors.

## Framework Adapters

- **[django-getpaid](https://github.com/django-getpaid/django-getpaid)** —
  Django adapter (models, views, forms, admin)

## Installation

```bash
pip install python-getpaid-core
```

You typically install this as a dependency of a framework adapter rather than
directly.

## Quick Example

```python
from getpaid_core.enums import PaymentStatus
from getpaid_core.fsm import create_payment_machine

# Any object satisfying the Payment protocol works
payment = MyPayment(status=PaymentStatus.NEW, amount_required=100)
machine = create_payment_machine(payment)

# FSM trigger methods are attached directly to the object
payment.confirm_prepared()
assert payment.status == PaymentStatus.PREPARED
```

## Requirements

- Python 3.12+
- transitions
- httpx
- anyio

## License

MIT

## Disclaimer

This project has nothing in common with the
[getpaid](http://code.google.com/p/getpaid/) plone project.

## Credits

Created by [Dominik Kozaczko](https://github.com/dekoza).
