python-getpaid-przelewy24 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. python_getpaid_przelewy24-0.1.0/.gitignore +20 -0
  2. python_getpaid_przelewy24-0.1.0/.pre-commit-config.yaml +15 -0
  3. python_getpaid_przelewy24-0.1.0/.python-version +1 -0
  4. python_getpaid_przelewy24-0.1.0/.readthedocs.yml +12 -0
  5. python_getpaid_przelewy24-0.1.0/CODE_OF_CONDUCT.md +132 -0
  6. python_getpaid_przelewy24-0.1.0/CONTRIBUTING.md +61 -0
  7. python_getpaid_przelewy24-0.1.0/LICENSE +21 -0
  8. python_getpaid_przelewy24-0.1.0/PKG-INFO +170 -0
  9. python_getpaid_przelewy24-0.1.0/README.md +147 -0
  10. python_getpaid_przelewy24-0.1.0/docs/changelog.md +21 -0
  11. python_getpaid_przelewy24-0.1.0/docs/codeofconduct.md +3 -0
  12. python_getpaid_przelewy24-0.1.0/docs/concepts.md +156 -0
  13. python_getpaid_przelewy24-0.1.0/docs/conf.py +29 -0
  14. python_getpaid_przelewy24-0.1.0/docs/configuration.md +73 -0
  15. python_getpaid_przelewy24-0.1.0/docs/contributing.md +2 -0
  16. python_getpaid_przelewy24-0.1.0/docs/getting-started.md +116 -0
  17. python_getpaid_przelewy24-0.1.0/docs/index.md +17 -0
  18. python_getpaid_przelewy24-0.1.0/docs/license.md +7 -0
  19. python_getpaid_przelewy24-0.1.0/docs/reference.md +25 -0
  20. python_getpaid_przelewy24-0.1.0/docs/requirements.txt +3 -0
  21. python_getpaid_przelewy24-0.1.0/pyproject.toml +114 -0
  22. python_getpaid_przelewy24-0.1.0/src/getpaid_przelewy24/__init__.py +22 -0
  23. python_getpaid_przelewy24-0.1.0/src/getpaid_przelewy24/client.py +386 -0
  24. python_getpaid_przelewy24-0.1.0/src/getpaid_przelewy24/processor.py +249 -0
  25. python_getpaid_przelewy24-0.1.0/src/getpaid_przelewy24/py.typed +0 -0
  26. python_getpaid_przelewy24-0.1.0/src/getpaid_przelewy24/types.py +195 -0
  27. python_getpaid_przelewy24-0.1.0/tests/__init__.py +0 -0
  28. python_getpaid_przelewy24-0.1.0/tests/conftest.py +146 -0
  29. python_getpaid_przelewy24-0.1.0/tests/test_callback.py +182 -0
  30. python_getpaid_przelewy24-0.1.0/tests/test_client.py +486 -0
  31. python_getpaid_przelewy24-0.1.0/tests/test_processor.py +247 -0
  32. python_getpaid_przelewy24-0.1.0/tests/test_types.py +47 -0
  33. python_getpaid_przelewy24-0.1.0/uv.lock +925 -0
@@ -0,0 +1,20 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+
12
+ # Coverage
13
+ .coverage
14
+ htmlcov/
15
+
16
+ # Implementation plans (local only)
17
+ .plans/
18
+
19
+ # Sphinx build output
20
+ docs/_build/
@@ -0,0 +1,15 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v5.0.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: end-of-file-fixer
7
+ - id: check-yaml
8
+ - id: check-added-large-files
9
+
10
+ - repo: https://github.com/astral-sh/ruff-pre-commit
11
+ rev: v0.11.12
12
+ hooks:
13
+ - id: ruff
14
+ args: [--fix]
15
+ - id: ruff-format
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,12 @@
1
+ version: 2
2
+ build:
3
+ os: ubuntu-24.04
4
+ tools:
5
+ python: "3.12"
6
+ sphinx:
7
+ configuration: docs/conf.py
8
+ formats: all
9
+ python:
10
+ install:
11
+ - requirements: docs/requirements.txt
12
+ - path: .
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ - Demonstrating empathy and kindness toward other people
21
+ - Being respectful of differing opinions, viewpoints, and experiences
22
+ - Giving and gracefully accepting constructive feedback
23
+ - Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ - Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ - The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ - Trolling, insulting or derogatory comments, and personal or political attacks
33
+ - Public or private harassment
34
+ - Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ - Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [dominik@kozaczko.info](mailto:dominik@kozaczko.info).
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][mozilla coc].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][faq]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [mozilla coc]: https://github.com/mozilla/diversity
131
+ [faq]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
@@ -0,0 +1,61 @@
1
+ # Contributor Guide
2
+
3
+ Thank you for your interest in improving getpaid-przelewy24.
4
+ This project is open-source under the [MIT license](https://github.com/django-getpaid/python-getpaid-przelewy24/blob/main/LICENSE) and
5
+ welcomes contributions in the form of bug reports, feature requests, and pull requests.
6
+
7
+ ## Resources
8
+
9
+ - [Source Code](https://github.com/django-getpaid/python-getpaid-przelewy24)
10
+ - [Documentation](https://getpaid-przelewy24.readthedocs.io/)
11
+ - [Issue Tracker](https://github.com/django-getpaid/python-getpaid-przelewy24/issues)
12
+
13
+ ## How to report a bug
14
+
15
+ Report bugs on the [Issue Tracker](https://github.com/django-getpaid/python-getpaid-przelewy24/issues).
16
+
17
+ When filing an issue, include:
18
+
19
+ - Operating system and Python version
20
+ - getpaid-przelewy24 version
21
+ - Steps to reproduce
22
+ - Expected vs actual behavior
23
+
24
+ ## How to set up your development environment
25
+
26
+ You need Python 3.12+ and [uv](https://docs.astral.sh/uv/).
27
+
28
+ Clone and install:
29
+
30
+ ```bash
31
+ git clone https://github.com/django-getpaid/python-getpaid-przelewy24.git
32
+ cd python-getpaid-przelewy24
33
+ uv sync
34
+ ```
35
+
36
+ Run tests:
37
+
38
+ ```bash
39
+ uv run pytest
40
+ ```
41
+
42
+ Run linting:
43
+
44
+ ```bash
45
+ uv run ruff check src/ tests/
46
+ uv run ruff format --check src/ tests/
47
+ ```
48
+
49
+ ## How to submit changes
50
+
51
+ 1. Fork the repository and create a feature branch
52
+ 2. Write tests for your changes
53
+ 3. Ensure all tests pass: `uv run pytest`
54
+ 4. Ensure linting passes: `uv run ruff check src/ tests/`
55
+ 5. Open a pull request
56
+
57
+ Your pull request needs to:
58
+
59
+ - Pass the test suite without errors
60
+ - Include tests for new functionality
61
+ - Update documentation if adding features
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright © 2022 Dominik Kozaczko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,170 @@
1
+ Metadata-Version: 2.4
2
+ Name: python-getpaid-przelewy24
3
+ Version: 0.1.0
4
+ Summary: Przelewy24 payment gateway integration for python-getpaid ecosystem.
5
+ Project-URL: Homepage, https://github.com/django-getpaid/python-getpaid-przelewy24
6
+ Project-URL: Repository, https://github.com/django-getpaid/python-getpaid-przelewy24
7
+ Project-URL: Changelog, https://github.com/django-getpaid/python-getpaid-przelewy24/releases
8
+ Author-email: Dominik Kozaczko <dominik@kozaczko.info>
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Topic :: Office/Business :: Financial
17
+ Classifier: Topic :: Office/Business :: Financial :: Point-Of-Sale
18
+ Classifier: Typing :: Typed
19
+ Requires-Python: >=3.12
20
+ Requires-Dist: httpx>=0.27.0
21
+ Requires-Dist: python-getpaid-core>=0.1.0
22
+ Description-Content-Type: text/markdown
23
+
24
+ # getpaid-przelewy24
25
+
26
+ [![PyPI](https://img.shields.io/pypi/v/python-getpaid-przelewy24.svg)](https://pypi.org/project/python-getpaid-przelewy24/)
27
+ [![Python Version](https://img.shields.io/pypi/pyversions/python-getpaid-przelewy24)](https://pypi.org/project/python-getpaid-przelewy24/)
28
+ [![License](https://img.shields.io/pypi/l/python-getpaid-przelewy24)](https://github.com/django-getpaid/python-getpaid-przelewy24/blob/main/LICENSE)
29
+
30
+ [Przelewy24](https://www.przelewy24.pl/) payment gateway plugin for the
31
+ [python-getpaid](https://github.com/django-getpaid) ecosystem. Provides an
32
+ async HTTP client (`P24Client`) and a payment processor (`P24Processor`) that
33
+ integrates with getpaid-core's `BaseProcessor` interface. Authentication uses
34
+ HTTP Basic Auth against the Przelewy24 REST API.
35
+
36
+ ## Architecture
37
+
38
+ The plugin is split into two layers:
39
+
40
+ - **`P24Client`** — low-level async HTTP client wrapping the Przelewy24 REST
41
+ API. Uses `httpx.AsyncClient` with HTTP Basic Auth (pos_id / api_key). Can be
42
+ used standalone or as an async context manager for connection reuse.
43
+ - **`P24Processor`** — high-level payment processor implementing
44
+ `BaseProcessor`. Orchestrates transaction registration, callback verification,
45
+ payment confirmation, status polling, and refunds. Integrates with the
46
+ getpaid-core FSM for state transitions.
47
+
48
+ ## Key Features
49
+
50
+ - **Register transaction** — create a payment session and get a redirect URL
51
+ - **Verify transaction** — mandatory confirmation after P24 callback (without
52
+ this, P24 treats the payment as advance only)
53
+ - **Refund** — batch refund support via P24 API
54
+ - **Get transaction info** — look up transaction by session ID
55
+ - **Get refund info** — look up refunds by P24 order ID
56
+ - **Get payment methods** — retrieve available payment methods for a language
57
+ - **Test access** — verify API credentials
58
+ - **PUSH and PULL** — callback-based notifications with optional status polling
59
+ - **SHA-384 signatures** — automatic sign calculation and verification
60
+
61
+ ## Quick Usage
62
+
63
+ ### Standalone Client
64
+
65
+ ```python
66
+ import asyncio
67
+ from decimal import Decimal
68
+ from getpaid_przelewy24 import P24Client
69
+
70
+ async def main():
71
+ async with P24Client(
72
+ merchant_id=12345,
73
+ pos_id=12345,
74
+ api_key="your-api-key",
75
+ crc_key="your-crc-key",
76
+ sandbox=True,
77
+ ) as client:
78
+ # Test connection
79
+ ok = await client.test_access()
80
+ print(f"Connection OK: {ok}")
81
+
82
+ # Register a transaction
83
+ response = await client.register_transaction(
84
+ session_id="order-001",
85
+ amount=Decimal("49.99"),
86
+ currency="PLN",
87
+ description="Order #001",
88
+ email="buyer@example.com",
89
+ url_return="https://shop.example.com/return/order-001",
90
+ url_status="https://shop.example.com/callback/order-001",
91
+ )
92
+ token = response["data"]["token"]
93
+ redirect_url = client.get_transaction_redirect_url(token)
94
+ print(f"Redirect buyer to: {redirect_url}")
95
+
96
+ asyncio.run(main())
97
+ ```
98
+
99
+ ### With django-getpaid
100
+
101
+ Register the plugin via entry point in `pyproject.toml`:
102
+
103
+ ```toml
104
+ [project.entry-points."getpaid.backends"]
105
+ przelewy24 = "getpaid_przelewy24.processor:P24Processor"
106
+ ```
107
+
108
+ Then configure in your Django settings (or config dict):
109
+
110
+ ```python
111
+ GETPAID_BACKEND_SETTINGS = {
112
+ "przelewy24": {
113
+ "merchant_id": 12345,
114
+ "pos_id": 12345,
115
+ "api_key": "your-api-key",
116
+ "crc_key": "your-crc-key",
117
+ "sandbox": True,
118
+ "url_status": "https://shop.example.com/payments/{payment_id}/callback/",
119
+ "url_return": "https://shop.example.com/payments/{payment_id}/return/",
120
+ "refund_url_status": "https://shop.example.com/payments/{payment_id}/refund-callback/",
121
+ }
122
+ }
123
+ ```
124
+
125
+ ## Configuration Reference
126
+
127
+ | Key | Type | Default | Description |
128
+ |-----|------|---------|-------------|
129
+ | `merchant_id` | `int` | *required* | Merchant ID from P24 panel |
130
+ | `pos_id` | `int` | *required* | POS ID (often same as merchant_id) |
131
+ | `api_key` | `str` | *required* | REST API key from P24 panel |
132
+ | `crc_key` | `str` | *required* | CRC key for signature calculation |
133
+ | `sandbox` | `bool` | `True` | Use sandbox (`sandbox.przelewy24.pl`) or production (`secure.przelewy24.pl`) |
134
+ | `url_status` | `str` | `""` | Callback URL template; use `{payment_id}` placeholder |
135
+ | `url_return` | `str` | `""` | Return URL template; use `{payment_id}` placeholder |
136
+ | `refund_url_status` | `str` | `""` | Refund callback URL template; use `{payment_id}` placeholder |
137
+
138
+ ## Supported Currencies
139
+
140
+ PLN, EUR, GBP, CZK, USD, BGN, DKK, HUF, NOK, SEK, CHF, RON, HRK (13 total).
141
+
142
+ ## Limitations
143
+
144
+ Przelewy24 does not support pre-authorization. The `charge()` and
145
+ `release_lock()` methods raise `NotImplementedError`.
146
+
147
+ ## Requirements
148
+
149
+ - Python 3.12+
150
+ - `python-getpaid-core >= 0.1.0`
151
+ - `httpx >= 0.27.0`
152
+
153
+ ## Related Projects
154
+
155
+ - [python-getpaid-core](https://github.com/django-getpaid/python-getpaid-core) — core abstractions (protocols, FSM, processor base class)
156
+ - [django-getpaid](https://github.com/django-getpaid/django-getpaid) — Django adapter (models, views, admin)
157
+
158
+ ## License
159
+
160
+ MIT
161
+
162
+ ## Disclaimer
163
+
164
+ This project has nothing in common with the
165
+ [getpaid](http://code.google.com/p/getpaid/) plone project.
166
+ It is part of the `django-getpaid` / `python-getpaid` ecosystem.
167
+
168
+ ## Credits
169
+
170
+ Created by [Dominik Kozaczko](https://github.com/dekoza).
@@ -0,0 +1,147 @@
1
+ # getpaid-przelewy24
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/python-getpaid-przelewy24.svg)](https://pypi.org/project/python-getpaid-przelewy24/)
4
+ [![Python Version](https://img.shields.io/pypi/pyversions/python-getpaid-przelewy24)](https://pypi.org/project/python-getpaid-przelewy24/)
5
+ [![License](https://img.shields.io/pypi/l/python-getpaid-przelewy24)](https://github.com/django-getpaid/python-getpaid-przelewy24/blob/main/LICENSE)
6
+
7
+ [Przelewy24](https://www.przelewy24.pl/) payment gateway plugin for the
8
+ [python-getpaid](https://github.com/django-getpaid) ecosystem. Provides an
9
+ async HTTP client (`P24Client`) and a payment processor (`P24Processor`) that
10
+ integrates with getpaid-core's `BaseProcessor` interface. Authentication uses
11
+ HTTP Basic Auth against the Przelewy24 REST API.
12
+
13
+ ## Architecture
14
+
15
+ The plugin is split into two layers:
16
+
17
+ - **`P24Client`** — low-level async HTTP client wrapping the Przelewy24 REST
18
+ API. Uses `httpx.AsyncClient` with HTTP Basic Auth (pos_id / api_key). Can be
19
+ used standalone or as an async context manager for connection reuse.
20
+ - **`P24Processor`** — high-level payment processor implementing
21
+ `BaseProcessor`. Orchestrates transaction registration, callback verification,
22
+ payment confirmation, status polling, and refunds. Integrates with the
23
+ getpaid-core FSM for state transitions.
24
+
25
+ ## Key Features
26
+
27
+ - **Register transaction** — create a payment session and get a redirect URL
28
+ - **Verify transaction** — mandatory confirmation after P24 callback (without
29
+ this, P24 treats the payment as advance only)
30
+ - **Refund** — batch refund support via P24 API
31
+ - **Get transaction info** — look up transaction by session ID
32
+ - **Get refund info** — look up refunds by P24 order ID
33
+ - **Get payment methods** — retrieve available payment methods for a language
34
+ - **Test access** — verify API credentials
35
+ - **PUSH and PULL** — callback-based notifications with optional status polling
36
+ - **SHA-384 signatures** — automatic sign calculation and verification
37
+
38
+ ## Quick Usage
39
+
40
+ ### Standalone Client
41
+
42
+ ```python
43
+ import asyncio
44
+ from decimal import Decimal
45
+ from getpaid_przelewy24 import P24Client
46
+
47
+ async def main():
48
+ async with P24Client(
49
+ merchant_id=12345,
50
+ pos_id=12345,
51
+ api_key="your-api-key",
52
+ crc_key="your-crc-key",
53
+ sandbox=True,
54
+ ) as client:
55
+ # Test connection
56
+ ok = await client.test_access()
57
+ print(f"Connection OK: {ok}")
58
+
59
+ # Register a transaction
60
+ response = await client.register_transaction(
61
+ session_id="order-001",
62
+ amount=Decimal("49.99"),
63
+ currency="PLN",
64
+ description="Order #001",
65
+ email="buyer@example.com",
66
+ url_return="https://shop.example.com/return/order-001",
67
+ url_status="https://shop.example.com/callback/order-001",
68
+ )
69
+ token = response["data"]["token"]
70
+ redirect_url = client.get_transaction_redirect_url(token)
71
+ print(f"Redirect buyer to: {redirect_url}")
72
+
73
+ asyncio.run(main())
74
+ ```
75
+
76
+ ### With django-getpaid
77
+
78
+ Register the plugin via entry point in `pyproject.toml`:
79
+
80
+ ```toml
81
+ [project.entry-points."getpaid.backends"]
82
+ przelewy24 = "getpaid_przelewy24.processor:P24Processor"
83
+ ```
84
+
85
+ Then configure in your Django settings (or config dict):
86
+
87
+ ```python
88
+ GETPAID_BACKEND_SETTINGS = {
89
+ "przelewy24": {
90
+ "merchant_id": 12345,
91
+ "pos_id": 12345,
92
+ "api_key": "your-api-key",
93
+ "crc_key": "your-crc-key",
94
+ "sandbox": True,
95
+ "url_status": "https://shop.example.com/payments/{payment_id}/callback/",
96
+ "url_return": "https://shop.example.com/payments/{payment_id}/return/",
97
+ "refund_url_status": "https://shop.example.com/payments/{payment_id}/refund-callback/",
98
+ }
99
+ }
100
+ ```
101
+
102
+ ## Configuration Reference
103
+
104
+ | Key | Type | Default | Description |
105
+ |-----|------|---------|-------------|
106
+ | `merchant_id` | `int` | *required* | Merchant ID from P24 panel |
107
+ | `pos_id` | `int` | *required* | POS ID (often same as merchant_id) |
108
+ | `api_key` | `str` | *required* | REST API key from P24 panel |
109
+ | `crc_key` | `str` | *required* | CRC key for signature calculation |
110
+ | `sandbox` | `bool` | `True` | Use sandbox (`sandbox.przelewy24.pl`) or production (`secure.przelewy24.pl`) |
111
+ | `url_status` | `str` | `""` | Callback URL template; use `{payment_id}` placeholder |
112
+ | `url_return` | `str` | `""` | Return URL template; use `{payment_id}` placeholder |
113
+ | `refund_url_status` | `str` | `""` | Refund callback URL template; use `{payment_id}` placeholder |
114
+
115
+ ## Supported Currencies
116
+
117
+ PLN, EUR, GBP, CZK, USD, BGN, DKK, HUF, NOK, SEK, CHF, RON, HRK (13 total).
118
+
119
+ ## Limitations
120
+
121
+ Przelewy24 does not support pre-authorization. The `charge()` and
122
+ `release_lock()` methods raise `NotImplementedError`.
123
+
124
+ ## Requirements
125
+
126
+ - Python 3.12+
127
+ - `python-getpaid-core >= 0.1.0`
128
+ - `httpx >= 0.27.0`
129
+
130
+ ## Related Projects
131
+
132
+ - [python-getpaid-core](https://github.com/django-getpaid/python-getpaid-core) — core abstractions (protocols, FSM, processor base class)
133
+ - [django-getpaid](https://github.com/django-getpaid/django-getpaid) — Django adapter (models, views, admin)
134
+
135
+ ## License
136
+
137
+ MIT
138
+
139
+ ## Disclaimer
140
+
141
+ This project has nothing in common with the
142
+ [getpaid](http://code.google.com/p/getpaid/) plone project.
143
+ It is part of the `django-getpaid` / `python-getpaid` ecosystem.
144
+
145
+ ## Credits
146
+
147
+ Created by [Dominik Kozaczko](https://github.com/dekoza).
@@ -0,0 +1,21 @@
1
+ # Changelog
2
+
3
+ ## v0.1.0 (2026-02-14)
4
+
5
+ Initial release.
6
+
7
+ ### Features
8
+
9
+ - Full Przelewy24 REST API coverage
10
+ - Async HTTP client (`P24Client`) with HTTP Basic Auth
11
+ - Payment processor (`P24Processor`) implementing `BaseProcessor`
12
+ - Transaction registration and verification
13
+ - SHA-384 signature calculation and verification
14
+ - Batch refund support
15
+ - Transaction lookup by session ID
16
+ - Refund lookup by order ID
17
+ - Payment methods retrieval
18
+ - Connection testing (`testAccess`)
19
+ - PUSH callback handling with mandatory verify step
20
+ - PULL status polling
21
+ - Amount conversion (`Decimal` <-> integer lowest currency unit)
@@ -0,0 +1,3 @@
1
+ ```{include} ../CODE_OF_CONDUCT.md
2
+
3
+ ```