forjio-storlaunch 0.2.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.
- forjio_storlaunch-0.2.0/.gitignore +8 -0
- forjio_storlaunch-0.2.0/CHANGELOG.md +17 -0
- forjio_storlaunch-0.2.0/LICENSE +21 -0
- forjio_storlaunch-0.2.0/PKG-INFO +117 -0
- forjio_storlaunch-0.2.0/README.md +92 -0
- forjio_storlaunch-0.2.0/pyproject.toml +39 -0
- forjio_storlaunch-0.2.0/storlaunch/__init__.py +52 -0
- forjio_storlaunch-0.2.0/storlaunch/api_generated.py +2756 -0
- forjio_storlaunch-0.2.0/storlaunch/client.py +829 -0
- forjio_storlaunch-0.2.0/storlaunch/errors.py +42 -0
- forjio_storlaunch-0.2.0/storlaunch/resources.py +195 -0
- forjio_storlaunch-0.2.0/storlaunch/webhooks.py +103 -0
- forjio_storlaunch-0.2.0/tests/__init__.py +0 -0
- forjio_storlaunch-0.2.0/tests/test_api_generated.py +65 -0
- forjio_storlaunch-0.2.0/tests/test_client.py +288 -0
- forjio_storlaunch-0.2.0/tests/test_routes_exist.py +87 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
- **Published on PyPI as `forjio-storlaunch`** (`pip install forjio-storlaunch`); the import is still `import storlaunch`. The old `storlaunch` 0.1.0 upload belongs to an account Forjio no longer publishes from (like `forjio-linksnap`).
|
|
5
|
+
- **Auth is an API key now.** Pass `api_key`: an `sk_live_…` / `sk_test_…` key from Settings → API keys (default: env `STORLAUNCH_API_KEY`), sent as `Authorization: Bearer <key>`. The `key_id`/`secret` request signing and `for_merchant()`/`on_behalf_of` (`X-Storlaunch-On-Behalf-Of`) are removed: the API never accepted them, so every call answered 401. A key belongs to one workspace.
|
|
6
|
+
- Writes send their idempotency key as `X-Idempotency-Key` (what Storlaunch's replay guard reads; subscription and portal-session creates require it) and `Idempotency-Key` (what it forwards to Plugipay).
|
|
7
|
+
- A 204 returns None; a CSV export returns its text.
|
|
8
|
+
- Methods now call the route the API really has: `payment.plans.archive` → `DELETE /payment/plans/{id}`; `payment.subscriptions.cancel(id, immediate=True)` → `DELETE /payment/subscriptions/{id}`; `storefront.licenses.revoke(key)` → `DELETE /storefront/licenses/{key}`; `account.api_keys.revoke` → `DELETE /account/api-keys/{id}` and `create` takes `name` + `environment`; `account.referrals.update_program` → `PUT`; `billing.checkout(plan=, interval=, currency=)` → `POST /billing/plugipay-invoice`; `modules.enable/disable` → `POST /modules {module, enabled}`; `inventory.levels({"variantId": …})` → `GET /inventory/stock`; `ledger.list/balances/adjust` → `/ledger/entries`, `/ledger/balance`, `/ledger/adjustments`; `reports.export_ledger()` → `GET /ledger/entries.csv`; `onboarding.complete_step` → `onboarding.complete(enable_payment=)`.
|
|
9
|
+
- Removed, because the API has no such route: `payment.invoices.finalize/pay/void`, `payment.plugipay_settings`, `storefront.products.list_files` (files come with `products.get`), `storefront.deliveries.create`, `analytics.storefront/funnel`, `billing.current_plan` (use `billing.subscription`), `modules.status` (use `modules.list`), `manual_orders.create`, `discount_codes.validate`, `inbound_webhooks`. Also removed: `buyer`, whose shopper routes take the shopper's storefront session, never an API key.
|
|
10
|
+
- `account.blog.list` is annotated as what it returns, a dict `{"posts": [...]}`.
|
|
11
|
+
- A test checks every hand-written method's route against the API spec (`backend/openapi.json`).
|
|
12
|
+
|
|
13
|
+
## 0.1.1
|
|
14
|
+
- `client.api`: every feature route of the Storlaunch API, one method each (`client.api.<area>_<action>(...)`), generated from the API spec and signed like every other call.
|
|
15
|
+
|
|
16
|
+
## 0.1.0
|
|
17
|
+
- Initial tracked release.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Forjio
|
|
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,117 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: forjio-storlaunch
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Official Python SDK for Storlaunch — payment (checkout sessions, plans, subscriptions, invoices, receipts, customers, portal sessions, webhooks), storefront (products, licenses, deliveries), shipping, inventory, ledger, reports, payouts, discount codes, account (pixels, feeds, blog, referrals, abandoned cart, API keys, audit log, domains), analytics, billing, modules, manual orders, onboarding.
|
|
5
|
+
Project-URL: Homepage, https://storlaunch.com
|
|
6
|
+
Project-URL: Source, https://github.com/hachimi-cat/storlaunch-python
|
|
7
|
+
Project-URL: Issues, https://github.com/hachimi-cat/storlaunch-python/issues
|
|
8
|
+
Author-email: Forjio <hello@storlaunch.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: ecommerce,forjio,payments,saas,storefront,storlaunch
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
17
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Requires-Python: >=3.9
|
|
20
|
+
Requires-Dist: httpx>=0.27.0
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
23
|
+
Requires-Dist: respx>=0.21.1; extra == 'dev'
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# storlaunch (Python SDK)
|
|
27
|
+
|
|
28
|
+
Official Python SDK for [Storlaunch](https://storlaunch.com) — full
|
|
29
|
+
parity with the Node SDK (`@forjio/storlaunch-node`).
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install forjio-storlaunch
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Quick start
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
import os
|
|
41
|
+
from storlaunch import StorlaunchClient
|
|
42
|
+
|
|
43
|
+
client = StorlaunchClient(
|
|
44
|
+
api_key=os.environ["STORLAUNCH_API_KEY"], # sk_live_… or sk_test_… (the default source)
|
|
45
|
+
base_url="https://storlaunch.com", # default
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
products = client.storefront.products.list({"limit": 20})
|
|
49
|
+
|
|
50
|
+
# Every feature route, one method each (generated from the API spec)
|
|
51
|
+
codes = client.api.discount_codes_list(limit=5)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Auth
|
|
55
|
+
|
|
56
|
+
Mint a secret key in the dashboard under **Settings → API keys**:
|
|
57
|
+
`sk_live_…` (production) or `sk_test_…` (sandbox). Every request carries it
|
|
58
|
+
as a bearer token, and nothing else authenticates:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
Authorization: Bearer sk_live_…
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
A key belongs to one workspace and acts as its owner. Two things it cannot
|
|
65
|
+
do: create or revoke API keys (that needs a signed-in session, so
|
|
66
|
+
`client.account.api_keys.create/revoke` answer 403 to a key), and call the
|
|
67
|
+
shopper routes under `/api/v1/checkout`, which take the shopper's own
|
|
68
|
+
storefront session.
|
|
69
|
+
|
|
70
|
+
Until 0.2.0 this SDK signed requests (`key_id` + `secret`,
|
|
71
|
+
`Storlaunch-HMAC-SHA256`) and scoped them with `for_merchant()` /
|
|
72
|
+
`X-Storlaunch-On-Behalf-Of`. The API never accepted either, so they are gone.
|
|
73
|
+
|
|
74
|
+
## Idempotency
|
|
75
|
+
|
|
76
|
+
Unsafe mutations (create checkout session, create subscription, issue
|
|
77
|
+
license, adjust inventory, request payout, etc.) auto-generate an
|
|
78
|
+
idempotency key, sent as both `X-Idempotency-Key` (what Storlaunch's replay
|
|
79
|
+
guard reads) and `Idempotency-Key` (what it forwards to Plugipay). To pin one
|
|
80
|
+
yourself, drop down to `client.request(...)`.
|
|
81
|
+
|
|
82
|
+
## Webhooks
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from storlaunch import verify_webhook
|
|
86
|
+
|
|
87
|
+
raw = request.get_data() # bytes — DO NOT re-serialise JSON
|
|
88
|
+
sig = request.headers.get("X-Storlaunch-Signature", "")
|
|
89
|
+
if not verify_webhook(raw, sig, secret):
|
|
90
|
+
abort(400)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Resource surface
|
|
94
|
+
|
|
95
|
+
| Namespace | Methods |
|
|
96
|
+
|---|---|
|
|
97
|
+
| `payment` | checkout_sessions, plans, subscriptions, invoices, receipts, customers, plugipay_settings, portal_sessions, webhook_endpoints, webhook_events |
|
|
98
|
+
| `storefront` | products (+files), licenses, deliveries, public |
|
|
99
|
+
| `account` | profile, pixels, abandoned_cart, feeds, blog, referrals, api_keys, audit_log, domains |
|
|
100
|
+
| top-level | analytics, billing, modules, manual_orders, onboarding, shipping, inventory, ledger, reports, payouts, discount_codes, inbound_webhooks, buyer |
|
|
101
|
+
|
|
102
|
+
For anything not yet typed, use `client.passthrough(method, path, body)`.
|
|
103
|
+
|
|
104
|
+
## Errors
|
|
105
|
+
|
|
106
|
+
All API failures raise `StorlaunchError(status, code, message, request_id)`.
|
|
107
|
+
Transport failures (DNS, connect refused, timeout) raise the same class
|
|
108
|
+
with `status=0` and `code` in `{"timeout", "network_error",
|
|
109
|
+
"invalid_response"}`.
|
|
110
|
+
|
|
111
|
+
## Dev
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
python3.12 -m venv .venv
|
|
115
|
+
.venv/bin/pip install -e ".[dev]"
|
|
116
|
+
.venv/bin/pytest -q
|
|
117
|
+
```
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# storlaunch (Python SDK)
|
|
2
|
+
|
|
3
|
+
Official Python SDK for [Storlaunch](https://storlaunch.com) — full
|
|
4
|
+
parity with the Node SDK (`@forjio/storlaunch-node`).
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pip install forjio-storlaunch
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Quick start
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
import os
|
|
16
|
+
from storlaunch import StorlaunchClient
|
|
17
|
+
|
|
18
|
+
client = StorlaunchClient(
|
|
19
|
+
api_key=os.environ["STORLAUNCH_API_KEY"], # sk_live_… or sk_test_… (the default source)
|
|
20
|
+
base_url="https://storlaunch.com", # default
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
products = client.storefront.products.list({"limit": 20})
|
|
24
|
+
|
|
25
|
+
# Every feature route, one method each (generated from the API spec)
|
|
26
|
+
codes = client.api.discount_codes_list(limit=5)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Auth
|
|
30
|
+
|
|
31
|
+
Mint a secret key in the dashboard under **Settings → API keys**:
|
|
32
|
+
`sk_live_…` (production) or `sk_test_…` (sandbox). Every request carries it
|
|
33
|
+
as a bearer token, and nothing else authenticates:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
Authorization: Bearer sk_live_…
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
A key belongs to one workspace and acts as its owner. Two things it cannot
|
|
40
|
+
do: create or revoke API keys (that needs a signed-in session, so
|
|
41
|
+
`client.account.api_keys.create/revoke` answer 403 to a key), and call the
|
|
42
|
+
shopper routes under `/api/v1/checkout`, which take the shopper's own
|
|
43
|
+
storefront session.
|
|
44
|
+
|
|
45
|
+
Until 0.2.0 this SDK signed requests (`key_id` + `secret`,
|
|
46
|
+
`Storlaunch-HMAC-SHA256`) and scoped them with `for_merchant()` /
|
|
47
|
+
`X-Storlaunch-On-Behalf-Of`. The API never accepted either, so they are gone.
|
|
48
|
+
|
|
49
|
+
## Idempotency
|
|
50
|
+
|
|
51
|
+
Unsafe mutations (create checkout session, create subscription, issue
|
|
52
|
+
license, adjust inventory, request payout, etc.) auto-generate an
|
|
53
|
+
idempotency key, sent as both `X-Idempotency-Key` (what Storlaunch's replay
|
|
54
|
+
guard reads) and `Idempotency-Key` (what it forwards to Plugipay). To pin one
|
|
55
|
+
yourself, drop down to `client.request(...)`.
|
|
56
|
+
|
|
57
|
+
## Webhooks
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
from storlaunch import verify_webhook
|
|
61
|
+
|
|
62
|
+
raw = request.get_data() # bytes — DO NOT re-serialise JSON
|
|
63
|
+
sig = request.headers.get("X-Storlaunch-Signature", "")
|
|
64
|
+
if not verify_webhook(raw, sig, secret):
|
|
65
|
+
abort(400)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Resource surface
|
|
69
|
+
|
|
70
|
+
| Namespace | Methods |
|
|
71
|
+
|---|---|
|
|
72
|
+
| `payment` | checkout_sessions, plans, subscriptions, invoices, receipts, customers, plugipay_settings, portal_sessions, webhook_endpoints, webhook_events |
|
|
73
|
+
| `storefront` | products (+files), licenses, deliveries, public |
|
|
74
|
+
| `account` | profile, pixels, abandoned_cart, feeds, blog, referrals, api_keys, audit_log, domains |
|
|
75
|
+
| top-level | analytics, billing, modules, manual_orders, onboarding, shipping, inventory, ledger, reports, payouts, discount_codes, inbound_webhooks, buyer |
|
|
76
|
+
|
|
77
|
+
For anything not yet typed, use `client.passthrough(method, path, body)`.
|
|
78
|
+
|
|
79
|
+
## Errors
|
|
80
|
+
|
|
81
|
+
All API failures raise `StorlaunchError(status, code, message, request_id)`.
|
|
82
|
+
Transport failures (DNS, connect refused, timeout) raise the same class
|
|
83
|
+
with `status=0` and `code` in `{"timeout", "network_error",
|
|
84
|
+
"invalid_response"}`.
|
|
85
|
+
|
|
86
|
+
## Dev
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
python3.12 -m venv .venv
|
|
90
|
+
.venv/bin/pip install -e ".[dev]"
|
|
91
|
+
.venv/bin/pytest -q
|
|
92
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.25"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "forjio-storlaunch"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Official Python SDK for Storlaunch — payment (checkout sessions, plans, subscriptions, invoices, receipts, customers, portal sessions, webhooks), storefront (products, licenses, deliveries), shipping, inventory, ledger, reports, payouts, discount codes, account (pixels, feeds, blog, referrals, abandoned cart, API keys, audit log, domains), analytics, billing, modules, manual orders, onboarding."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.9"
|
|
12
|
+
keywords = ["storlaunch", "forjio", "ecommerce", "storefront", "payments", "saas"]
|
|
13
|
+
authors = [{ name = "Forjio", email = "hello@storlaunch.com" }]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
19
|
+
"Topic :: Internet :: WWW/HTTP",
|
|
20
|
+
"Topic :: Office/Business :: Financial",
|
|
21
|
+
"Typing :: Typed",
|
|
22
|
+
]
|
|
23
|
+
dependencies = [
|
|
24
|
+
"httpx>=0.27.0",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.optional-dependencies]
|
|
28
|
+
dev = [
|
|
29
|
+
"pytest>=8.0.0",
|
|
30
|
+
"respx>=0.21.1",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Homepage = "https://storlaunch.com"
|
|
35
|
+
Source = "https://github.com/hachimi-cat/storlaunch-python"
|
|
36
|
+
Issues = "https://github.com/hachimi-cat/storlaunch-python/issues"
|
|
37
|
+
|
|
38
|
+
[tool.hatch.build.targets.wheel]
|
|
39
|
+
packages = ["storlaunch"]
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""Official Python SDK for Storlaunch.
|
|
2
|
+
|
|
3
|
+
Mirrors the Node SDK (``@forjio/storlaunch-node``) surface 1:1:
|
|
4
|
+
|
|
5
|
+
- An API key (``sk_live_…`` / ``sk_test_…``) sent as ``Authorization: Bearer``.
|
|
6
|
+
- Auto-generated idempotency keys for unsafe mutations.
|
|
7
|
+
- Resource namespaces covering payment, storefront, account, analytics,
|
|
8
|
+
billing, modules, manual orders, onboarding, shipping, inventory, ledger,
|
|
9
|
+
reports, payouts and discount codes, plus ``client.api``: every feature
|
|
10
|
+
route, generated from the API spec.
|
|
11
|
+
- Webhook signature verification (``X-Storlaunch-Signature`` HMAC).
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from .client import StorlaunchClient
|
|
15
|
+
from .errors import StorlaunchError
|
|
16
|
+
from .resources import (
|
|
17
|
+
ApiEnvelope,
|
|
18
|
+
ApiEnvelopeError,
|
|
19
|
+
ApiEnvelopeMeta,
|
|
20
|
+
CheckoutSession,
|
|
21
|
+
Customer,
|
|
22
|
+
CurrencyCode,
|
|
23
|
+
Invoice,
|
|
24
|
+
Plan,
|
|
25
|
+
Product,
|
|
26
|
+
Subscription,
|
|
27
|
+
WebhookEvent,
|
|
28
|
+
)
|
|
29
|
+
from .webhooks import verify_webhook
|
|
30
|
+
|
|
31
|
+
__all__ = [
|
|
32
|
+
# client
|
|
33
|
+
"StorlaunchClient",
|
|
34
|
+
# errors
|
|
35
|
+
"StorlaunchError",
|
|
36
|
+
# resources
|
|
37
|
+
"ApiEnvelope",
|
|
38
|
+
"ApiEnvelopeError",
|
|
39
|
+
"ApiEnvelopeMeta",
|
|
40
|
+
"CheckoutSession",
|
|
41
|
+
"Customer",
|
|
42
|
+
"CurrencyCode",
|
|
43
|
+
"Invoice",
|
|
44
|
+
"Plan",
|
|
45
|
+
"Product",
|
|
46
|
+
"Subscription",
|
|
47
|
+
"WebhookEvent",
|
|
48
|
+
# webhooks
|
|
49
|
+
"verify_webhook",
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
__version__ = "0.2.0"
|