Metadata-Version: 2.5
Name: university-payments
Version: 0.1.2
Summary: University Payments: provider-agnostic payments (Paystack, Flutterwave, Stripe), verified webhooks, refunds, escrow ledger and payouts for the University platform.
Project-URL: Homepage, https://github.com/NzeStan/University
Project-URL: Documentation, https://github.com/NzeStan/University/blob/main/docs/modules/payments.md
Project-URL: Source, https://github.com/NzeStan/University
Project-URL: Changelog, https://github.com/NzeStan/University/blob/main/CHANGELOG.md
Author-email: Ifeanyi Stanley <nnamaniifeanyi10@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: africa,django,drf,escrow,flutterwave,payments,paystack,stripe,university
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Django
Classifier: Framework :: Django :: 5.2
Classifier: Framework :: Django :: 6.0
Classifier: Framework :: Django :: 6.1
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: university-core<0.2,>=0.1.1
Provides-Extra: test
Requires-Dist: drf-spectacular>=0.27; extra == 'test'
Requires-Dist: pytest-cov>=5; extra == 'test'
Requires-Dist: pytest-django>=4.8; extra == 'test'
Requires-Dist: pytest>=8; extra == 'test'
Description-Content-Type: text/markdown

# university-payments

Provider-agnostic payments for the [University platform](https://github.com/NzeStan/University):
Paystack, Flutterwave and Stripe adapters, verified webhooks, refunds, an escrow ledger and payouts.
This is an optional *level two* module that depends only on `university-core`. Core never depends
on a payment provider.

- **Sells for any module.**
  - Events (tickets), marketplace (orders) and creator (sponsorship fees) describe what's owed
    through Core's payable adapters. No module imports another.
- **Built on mistrust.**
  - Amounts come from the selling module, never the client.
  - Success always comes from re-verifying with the provider, never from webhook bodies or
    redirects.
  - Amount and currency must match exactly.
  - Every state change is locked and idempotent.
  - Checkout requires an `Idempotency-Key`.
- **Verified webhooks** through Core's pipeline: provider signatures (HMAC-SHA512, Stripe's
  timestamped signatures, Flutterwave's hash), replay protection, de-duplication and logging.
- **Automatic refunds** when a seller can't fulfil (for example, a ticket hold expired before
  payment arrived), or when the wrong amount was paid.
- **Double-entry ledger.** Escrow is held until the selling module releases it, alongside
  available balances and platform fees. Payouts are requested by sellers and processed by
  finance with four-eyes checks and no stored account numbers.
- **Admin** is read-only; money moves only through audited services.

```bash
pip install university-payments
```

```python
INSTALLED_APPS += ["university.payments"]
UNIVERSITY = {
    "PAYMENTS": {
        "PROVIDERS": {
            "paystack": {
                "class": "university.payments.providers.paystack.PaystackProvider",
                "options": {"secret_key": os.environ["PAYSTACK_SECRET_KEY"]},
            }
        }
    }
}
```

See [the module documentation](../../docs/modules/payments.md).
