forjio-storlaunch 0.2.0__py3-none-any.whl
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.dist-info/METADATA +117 -0
- forjio_storlaunch-0.2.0.dist-info/RECORD +10 -0
- forjio_storlaunch-0.2.0.dist-info/WHEEL +4 -0
- forjio_storlaunch-0.2.0.dist-info/licenses/LICENSE +21 -0
- storlaunch/__init__.py +52 -0
- storlaunch/api_generated.py +2756 -0
- storlaunch/client.py +829 -0
- storlaunch/errors.py +42 -0
- storlaunch/resources.py +195 -0
- storlaunch/webhooks.py +103 -0
|
@@ -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,10 @@
|
|
|
1
|
+
storlaunch/__init__.py,sha256=LsdjkYo27OPjyDlIvk_pjsstegWzvLTDpWz6YFs6V_M,1271
|
|
2
|
+
storlaunch/api_generated.py,sha256=OjF2QMxUQfnPtYWBCxiqLm6fmRoMOJonmRFB-XJg55w,163465
|
|
3
|
+
storlaunch/client.py,sha256=c9VujmgErRsOflbmYg1zZilWSsNnyONpxaCzk_-azdM,29858
|
|
4
|
+
storlaunch/errors.py,sha256=cejqkgY9qzDlrXbhZ4M06UxIpXnKSJ9rTrhqE45fLLQ,1143
|
|
5
|
+
storlaunch/resources.py,sha256=YrqY76iPrJ_IGuYF_8gTDU5Rh6yQ5vyj2_RPrcPBYbs,4697
|
|
6
|
+
storlaunch/webhooks.py,sha256=O3D09iiFGPdHZnDnqF9JapQY2df5iJazfzpq50HzBdI,3056
|
|
7
|
+
forjio_storlaunch-0.2.0.dist-info/METADATA,sha256=pFASU8bRcupdH9l2Xf5v1ASyFbPuVLrQt_Qi5Qf8UzE,4285
|
|
8
|
+
forjio_storlaunch-0.2.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
9
|
+
forjio_storlaunch-0.2.0.dist-info/licenses/LICENSE,sha256=rW8S5IWqVAXbxPGdwy_Df-YrBzv9KrJsbfsIK4oCVdk,1063
|
|
10
|
+
forjio_storlaunch-0.2.0.dist-info/RECORD,,
|
|
@@ -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.
|
storlaunch/__init__.py
ADDED
|
@@ -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"
|