paymos-sdk 1.0.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.
@@ -0,0 +1,39 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ concurrency:
12
+ group: ci-${{ github.workflow }}-${{ github.ref }}
13
+ cancel-in-progress: true
14
+
15
+ jobs:
16
+ test:
17
+ strategy:
18
+ fail-fast: false
19
+ matrix:
20
+ python: ["3.10", "3.13"]
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
24
+ - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
25
+ with:
26
+ python-version: ${{ matrix.python }}
27
+ cache: pip
28
+ - run: python -m pip install --disable-pip-version-check ".[dev]"
29
+ - run: python -m ruff format --check .
30
+ - run: python -m ruff check .
31
+ - run: python -m mypy src/paymos
32
+ - run: python -m unittest discover -s tests
33
+ - run: python -m build
34
+ - name: Test the built wheel in isolation
35
+ run: |
36
+ python -m venv /tmp/paymos-smoke
37
+ /tmp/paymos-smoke/bin/python -m pip install --disable-pip-version-check dist/*.whl
38
+ cd /tmp
39
+ /tmp/paymos-smoke/bin/python -c "import paymos; assert paymos.VERSION"
@@ -0,0 +1,54 @@
1
+ name: Publish
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ concurrency:
11
+ group: publish-${{ github.ref }}
12
+ cancel-in-progress: false
13
+
14
+ jobs:
15
+ build:
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
19
+ with:
20
+ persist-credentials: false
21
+ - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
22
+ with:
23
+ python-version: "3.13"
24
+ - name: Verify immutable release version
25
+ run: python -c "import os,tomllib,pathlib; actual=tomllib.loads(pathlib.Path('pyproject.toml').read_text())['project']['version']; expected=os.environ['GITHUB_REF_NAME'][1:]; assert actual == expected, f'tag {expected} != package {actual}'"
26
+ - run: python -m pip install --disable-pip-version-check ".[dev]"
27
+ - run: python -m ruff format --check .
28
+ - run: python -m ruff check .
29
+ - run: python -m mypy src/paymos
30
+ - run: python -m unittest discover -s tests
31
+ - run: python -m build
32
+ - name: Test the built wheel in isolation
33
+ run: |
34
+ python -m venv /tmp/paymos-smoke
35
+ /tmp/paymos-smoke/bin/python -m pip install --disable-pip-version-check dist/*.whl
36
+ cd /tmp
37
+ /tmp/paymos-smoke/bin/python -c "import paymos; assert paymos.VERSION"
38
+ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
39
+ with:
40
+ name: python-package
41
+ path: dist/
42
+ if-no-files-found: error
43
+
44
+ pypi:
45
+ needs: build
46
+ runs-on: ubuntu-latest
47
+ permissions:
48
+ id-token: write
49
+ steps:
50
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
51
+ with:
52
+ name: python-package
53
+ path: dist/
54
+ - uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
@@ -0,0 +1,6 @@
1
+ /dist/
2
+ /build/
3
+ /.pytest_cache/
4
+ /.mypy_cache/
5
+ **/__pycache__/
6
+ *.egg-info/
@@ -0,0 +1,6 @@
1
+ {
2
+ "source_repository": "shockk73/paymos",
3
+ "source_path": "plugins/python-sdk",
4
+ "source_commit": "ff7ac0de110726a02b796e00345630fef5e89b76",
5
+ "version": "1.0.0"
6
+ }
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ ## [Unreleased]
4
+
5
+ ## [1.0.0]
6
+
7
+ - Initial official SDK.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Paymos Labs
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,74 @@
1
+ Metadata-Version: 2.4
2
+ Name: paymos-sdk
3
+ Version: 1.0.0
4
+ Summary: Official Python SDK for the Paymos Merchant API
5
+ Project-URL: Documentation, https://paymos.io/docs/server-sdks
6
+ Project-URL: Repository, https://github.com/Paymos-labs/python-sdk
7
+ Project-URL: Issues, https://github.com/Paymos-labs/python-sdk/issues
8
+ Author-email: Paymos Labs <support@paymos.io>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: payments,paymos,stablecoins,usdc,usdt
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.10
21
+ Provides-Extra: dev
22
+ Requires-Dist: build==1.5.1; extra == 'dev'
23
+ Requires-Dist: mypy==2.2.0; extra == 'dev'
24
+ Requires-Dist: ruff==0.15.21; extra == 'dev'
25
+ Description-Content-Type: text/markdown
26
+
27
+ # Paymos Python SDK
28
+
29
+ Official Python 3.10+ client for the Paymos Merchant API. It includes HMAC request
30
+ signing, invoices, withdrawals, balances, bounded cursor iterators, structured
31
+ errors, safe retries, and raw-body webhook verification.
32
+
33
+ ```bash
34
+ pip install paymos-sdk
35
+ ```
36
+
37
+ ```python
38
+ import os
39
+
40
+ from paymos import Paymos
41
+
42
+ paymos = Paymos(
43
+ api_key=os.environ["PAYMOS_API_KEY"],
44
+ api_secret=os.environ["PAYMOS_API_SECRET"],
45
+ )
46
+ invoice = paymos.invoices.create(
47
+ project_id="prj_...", amount="10.00", currency="USD",
48
+ external_order_id="order_123",
49
+ )
50
+ ```
51
+
52
+ Use decimal strings for money. `list()` returns one cursor page; `iterate()`
53
+ follows cursors lazily and stops after 100 pages by default.
54
+
55
+ ```python
56
+ for invoice in paymos.invoices.iterate(status=["paid", "paid_over"], max_pages=10):
57
+ print(invoice["invoice_id"])
58
+ ```
59
+
60
+ API failures raise typed subclasses of `ApiError` and preserve the HTTP status,
61
+ problem details, field, error code, headers, and `Retry-After` value.
62
+
63
+ Verify webhooks against the exact raw request body before parsing it:
64
+
65
+ ```python
66
+ from paymos import WebhookVerifier
67
+
68
+ event = WebhookVerifier(os.environ["PAYMOS_WEBHOOK_SECRET"]).construct_event(
69
+ request.headers["X-Webhook-Signature"], request.get_data()
70
+ )
71
+ ```
72
+
73
+ Never use the API secret in browser or mobile code. Full documentation:
74
+ https://paymos.io/docs/server-sdks
@@ -0,0 +1,48 @@
1
+ # Paymos Python SDK
2
+
3
+ Official Python 3.10+ client for the Paymos Merchant API. It includes HMAC request
4
+ signing, invoices, withdrawals, balances, bounded cursor iterators, structured
5
+ errors, safe retries, and raw-body webhook verification.
6
+
7
+ ```bash
8
+ pip install paymos-sdk
9
+ ```
10
+
11
+ ```python
12
+ import os
13
+
14
+ from paymos import Paymos
15
+
16
+ paymos = Paymos(
17
+ api_key=os.environ["PAYMOS_API_KEY"],
18
+ api_secret=os.environ["PAYMOS_API_SECRET"],
19
+ )
20
+ invoice = paymos.invoices.create(
21
+ project_id="prj_...", amount="10.00", currency="USD",
22
+ external_order_id="order_123",
23
+ )
24
+ ```
25
+
26
+ Use decimal strings for money. `list()` returns one cursor page; `iterate()`
27
+ follows cursors lazily and stops after 100 pages by default.
28
+
29
+ ```python
30
+ for invoice in paymos.invoices.iterate(status=["paid", "paid_over"], max_pages=10):
31
+ print(invoice["invoice_id"])
32
+ ```
33
+
34
+ API failures raise typed subclasses of `ApiError` and preserve the HTTP status,
35
+ problem details, field, error code, headers, and `Retry-After` value.
36
+
37
+ Verify webhooks against the exact raw request body before parsing it:
38
+
39
+ ```python
40
+ from paymos import WebhookVerifier
41
+
42
+ event = WebhookVerifier(os.environ["PAYMOS_WEBHOOK_SECRET"]).construct_event(
43
+ request.headers["X-Webhook-Signature"], request.get_data()
44
+ )
45
+ ```
46
+
47
+ Never use the API secret in browser or mobile code. Full documentation:
48
+ https://paymos.io/docs/server-sdks
@@ -0,0 +1,98 @@
1
+ {
2
+ "schema": 1,
3
+ "base_url": "https://api.paymos.io",
4
+ "user_agent_prefix": "paymos-",
5
+ "request_signing": {
6
+ "algorithm": "HMAC-SHA256",
7
+ "signature_encoding": "base64",
8
+ "timestamp_header": "X-Request-Timestamp",
9
+ "authorization_format": "HMAC-SHA256 {api_key}:{signature}",
10
+ "canonical_format": "{timestamp}\\n{uppercase_method}\\n{path}\\n{query_with_optional_leading_question_mark}\\n{sha256_hex_body_or_empty}"
11
+ },
12
+ "query": {
13
+ "encoding": "RFC3986",
14
+ "sort_keys": true,
15
+ "sort_repeated_values": true,
16
+ "include_leading_question_mark_in_signature": true
17
+ },
18
+ "retry": {
19
+ "default_max_retries": 2,
20
+ "default_base_delay_ms": 150,
21
+ "retry_after": true,
22
+ "transport_errors": ["GET", "HEAD", "OPTIONS"],
23
+ "http_5xx": ["GET", "HEAD", "OPTIONS"],
24
+ "http_429": ["GET", "HEAD", "OPTIONS", "POST"]
25
+ },
26
+ "pagination": {
27
+ "default_max_pages": 100,
28
+ "next_cursor_field": "next_cursor",
29
+ "reject_repeated_cursor": true
30
+ },
31
+ "errors": {
32
+ "400": "validation",
33
+ "401": "authentication",
34
+ "403": "authentication",
35
+ "404": "not_found",
36
+ "409": "conflict",
37
+ "410": "gone",
38
+ "429": "rate_limit",
39
+ "500": "server",
40
+ "503": "unavailable"
41
+ },
42
+ "resources": {
43
+ "system": [
44
+ { "method": "GET", "path": "/v1/time", "operation": "time" }
45
+ ],
46
+ "invoices": [
47
+ { "method": "POST", "path": "/v1/invoices", "operation": "create" },
48
+ { "method": "GET", "path": "/v1/invoices/{id}", "operation": "get" },
49
+ { "method": "GET", "path": "/v1/invoices", "operation": "list" },
50
+ { "method": "POST", "path": "/v1/invoices/{id}/cancel", "operation": "cancel" },
51
+ { "method": "POST", "path": "/v1/invoices/{id}/confirm-payment", "operation": "confirm_payment" },
52
+ { "method": "POST", "path": "/v1/sandbox/invoices/{id}/simulate-payment", "operation": "simulate_payment" }
53
+ ],
54
+ "withdrawals": [
55
+ { "method": "POST", "path": "/v1/withdrawals", "operation": "create" },
56
+ { "method": "GET", "path": "/v1/withdrawals/{id}", "operation": "get" },
57
+ { "method": "GET", "path": "/v1/withdrawals", "operation": "list" },
58
+ { "method": "POST", "path": "/v1/withdrawals/{id}/cancel", "operation": "cancel" },
59
+ { "method": "POST", "path": "/v1/sandbox/withdrawals/{id}/simulate-completion", "operation": "simulate_completion" }
60
+ ],
61
+ "balances": [
62
+ { "method": "GET", "path": "/v1/balances", "operation": "get" }
63
+ ]
64
+ },
65
+ "vectors": {
66
+ "post_signing": {
67
+ "api_key": "pk_test_key",
68
+ "api_secret": "sk_test_secret",
69
+ "timestamp": "1700000000",
70
+ "method": "POST",
71
+ "path": "/v1/invoices",
72
+ "query": "",
73
+ "body": "{\"amount\":\"10.00\"}",
74
+ "body_sha256": "e9eb495accbce2a0e95bbe079b9f9e42ccae20371c1516e3ed3036d2a787cf53",
75
+ "signature": "AS+pbf8GlSGee9Oh5XhpasBpXB488AGEoqjDMx+dwak=",
76
+ "authorization": "HMAC-SHA256 pk_test_key:AS+pbf8GlSGee9Oh5XhpasBpXB488AGEoqjDMx+dwak="
77
+ },
78
+ "get_query_signing": {
79
+ "api_key": "pk_test_key",
80
+ "api_secret": "sk_test_secret",
81
+ "timestamp": "1700000000",
82
+ "method": "GET",
83
+ "path": "/v1/invoices",
84
+ "query": "?limit=50&project_id=prj%2Fa&status=paid&status=paid_over",
85
+ "body": "",
86
+ "signature": "O8M5GGSzzJAgj5w1jDViIWS4njJvohvnZi7+twuG+e0="
87
+ },
88
+ "webhook": {
89
+ "secret": "whsec_test_secret",
90
+ "timestamp": 1700000000,
91
+ "now": 1700000000,
92
+ "tolerance_seconds": 300,
93
+ "raw_body": "{\"event_id\":\"evt_123\",\"event_type\":\"invoice.paid\",\"version\":1,\"occurred_at\":1700000000,\"data\":{\"invoice_id\":\"inv_123\"}}",
94
+ "signature": "8f62822925c2d12af1b822edcc1e9392ce064c20d003cbbc11f131485348005b",
95
+ "header": "t=1700000000,v1=ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff,v1=8f62822925c2d12af1b822edcc1e9392ce064c20d003cbbc11f131485348005b"
96
+ }
97
+ }
98
+ }
@@ -0,0 +1,51 @@
1
+ [build-system]
2
+ requires = ["hatchling==1.31.0"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "paymos-sdk"
7
+ version = "1.0.0"
8
+ description = "Official Python SDK for the Paymos Merchant API"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "Paymos Labs", email = "support@paymos.io" }]
14
+ keywords = ["paymos", "payments", "stablecoins", "usdt", "usdc"]
15
+ classifiers = [
16
+ "Development Status :: 5 - Production/Stable",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.10",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Programming Language :: Python :: 3.13",
23
+ "Typing :: Typed"
24
+ ]
25
+
26
+ [project.optional-dependencies]
27
+ dev = [
28
+ "build==1.5.1",
29
+ "mypy==2.2.0",
30
+ "ruff==0.15.21"
31
+ ]
32
+
33
+ [project.urls]
34
+ Documentation = "https://paymos.io/docs/server-sdks"
35
+ Repository = "https://github.com/Paymos-labs/python-sdk"
36
+ Issues = "https://github.com/Paymos-labs/python-sdk/issues"
37
+
38
+ [tool.hatch.build.targets.wheel]
39
+ packages = ["src/paymos"]
40
+
41
+ [tool.mypy]
42
+ python_version = "3.10"
43
+ strict = true
44
+ packages = ["paymos"]
45
+
46
+ [tool.ruff]
47
+ line-length = 120
48
+ target-version = "py310"
49
+
50
+ [tool.ruff.lint]
51
+ select = ["E4", "E7", "E9", "F", "I", "UP", "B"]
@@ -0,0 +1,65 @@
1
+ from .client import Paymos, Response
2
+ from .errors import (
3
+ ApiError,
4
+ AuthenticationError,
5
+ ConfigurationError,
6
+ ConflictError,
7
+ GoneError,
8
+ NotFoundError,
9
+ PaymosError,
10
+ RateLimitError,
11
+ ServerError,
12
+ SignatureMismatchError,
13
+ TimestampSkewError,
14
+ UnavailableError,
15
+ ValidationError,
16
+ )
17
+ from .models import (
18
+ Balance,
19
+ Invoice,
20
+ InvoiceListItem,
21
+ InvoicePage,
22
+ InvoiceStatus,
23
+ ServerTime,
24
+ WebhookEvent,
25
+ Withdrawal,
26
+ WithdrawalPage,
27
+ WithdrawalStatus,
28
+ )
29
+ from .signing import authorization_header, build_query, sign, string_to_sign
30
+ from .version import VERSION
31
+ from .webhooks import WebhookVerifier
32
+
33
+ __all__ = [
34
+ "ApiError",
35
+ "AuthenticationError",
36
+ "ConfigurationError",
37
+ "ConflictError",
38
+ "GoneError",
39
+ "NotFoundError",
40
+ "Paymos",
41
+ "PaymosError",
42
+ "RateLimitError",
43
+ "Response",
44
+ "ServerError",
45
+ "SignatureMismatchError",
46
+ "TimestampSkewError",
47
+ "UnavailableError",
48
+ "ValidationError",
49
+ "VERSION",
50
+ "WebhookVerifier",
51
+ "Balance",
52
+ "Invoice",
53
+ "InvoiceListItem",
54
+ "InvoicePage",
55
+ "InvoiceStatus",
56
+ "ServerTime",
57
+ "WebhookEvent",
58
+ "Withdrawal",
59
+ "WithdrawalPage",
60
+ "WithdrawalStatus",
61
+ "authorization_header",
62
+ "build_query",
63
+ "sign",
64
+ "string_to_sign",
65
+ ]