@siglume/direct-request-payment 0.4.19 → 0.4.22
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.
- package/CHANGELOG.md +50 -0
- package/README.md +18 -10
- package/bin/siglume-sdrp.mjs +550 -8
- package/dist/index.cjs +37 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -2
- package/dist/index.d.ts +27 -2
- package/dist/index.js +37 -3
- package/dist/index.js.map +1 -1
- package/docs/announcement-ja.md +17 -3
- package/docs/api-reference.md +60 -13
- package/docs/merchant-quickstart.md +6 -20
- package/docs/metered-statements.md +15 -13
- package/docs/payment-lifecycle.md +12 -9
- package/docs/pricing.md +7 -4
- package/docs/quickstart-10-minutes.md +134 -24
- package/docs/sandbox.md +60 -0
- package/docs/troubleshooting.md +23 -8
- package/examples/express-checkout.ts +37 -13
- package/examples/hosted-checkout-python/app.py +46 -31
- package/examples/hosted-checkout-python/order_store.py +13 -3
- package/examples/hosted-checkout-python/pyproject.toml +1 -1
- package/examples/hosted-checkout-typescript/src/order-store.ts +14 -3
- package/examples/hosted-checkout-typescript/src/server.ts +49 -37
- package/package.json +10 -2
- package/templates/express/README.md +40 -6
- package/templates/express/siglume-order-store.example.ts +22 -6
- package/templates/express/siglume-order-store.sql.ts +585 -0
- package/templates/express/siglume-sdrp-routes.ts +138 -64
- package/templates/fastapi/README.md +22 -3
- package/templates/fastapi/siglume_order_store_example.py +29 -6
- package/templates/fastapi/siglume_order_store_sqlalchemy.py +313 -0
- package/templates/fastapi/siglume_sdrp_routes.py +112 -49
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.22 - 2026-06-20
|
|
4
|
+
|
|
5
|
+
- Fixed clean-checkout TypeScript resolution for template imports so CI and npm
|
|
6
|
+
release typechecks do not depend on a prebuilt `dist/` directory.
|
|
7
|
+
|
|
8
|
+
## 0.4.21 - 2026-06-20
|
|
9
|
+
|
|
10
|
+
Complete the 10-minute integration path with durable adapters, sandbox, and E2E.
|
|
11
|
+
|
|
12
|
+
- Added a local `siglume-sdrp sandbox` server that creates fake Hosted Checkout
|
|
13
|
+
sessions, sends signed `direct_payment.confirmed` webhooks, records delivery
|
|
14
|
+
status, and never charges a wallet.
|
|
15
|
+
- Added `SIGLUME_ENV=sandbox`, `SIGLUME_SANDBOX_API_BASE`, and
|
|
16
|
+
`siglume-check readiness --sandbox` so sandbox and live checks are explicit.
|
|
17
|
+
- Added durable Express SQL/ORM order-store adapters for Prisma, TypeORM,
|
|
18
|
+
Sequelize, Drizzle, and generic SQL executors.
|
|
19
|
+
- Added a durable FastAPI SQLAlchemy order-store adapter and packaged it in the
|
|
20
|
+
Python templates.
|
|
21
|
+
- Added Express and FastAPI E2E tests covering checkout start, checkout URL
|
|
22
|
+
reuse, signed webhook success, duplicate webhook suppression, retry after
|
|
23
|
+
handler failure, and Standard-only Micro/Nano blocking.
|
|
24
|
+
- Updated the 10-minute guide, sandbox guide, template READMEs, API reference,
|
|
25
|
+
troubleshooting, and README so implementers can test locally before live
|
|
26
|
+
credentials.
|
|
27
|
+
|
|
28
|
+
## 0.4.20 - 2026-06-20
|
|
29
|
+
|
|
30
|
+
Close the v0.4.19 public onboarding safety review.
|
|
31
|
+
|
|
32
|
+
- Fixed generated Express/FastAPI webhook handling so webhook event ids are
|
|
33
|
+
recorded as processed only after the order update or durable review write
|
|
34
|
+
succeeds. A retry after a mid-handler failure is no longer discarded as a
|
|
35
|
+
duplicate.
|
|
36
|
+
- Added stable checkout attempts/nonces to generated routes and starters so a
|
|
37
|
+
retry or double click reuses the active attempt instead of creating a fresh
|
|
38
|
+
timestamp nonce.
|
|
39
|
+
- Split Express checkout and webhook mounting helpers so production apps can
|
|
40
|
+
mount the raw-body webhook before global `express.json()`.
|
|
41
|
+
- Strengthened `siglume-check readiness` to require `SIGLUME_WEBHOOK_SECRET`,
|
|
42
|
+
active billing, matching active webhook subscription, subscribed
|
|
43
|
+
`direct_payment.confirmed`, matching signing-secret hint, Hosted Checkout
|
|
44
|
+
probe, and signed webhook delivery probe.
|
|
45
|
+
- Added webhook subscription/test-delivery/delivery-list client helpers in
|
|
46
|
+
TypeScript and Python.
|
|
47
|
+
- Made generated 10-minute routes Standard-only by default; Micro / Nano now
|
|
48
|
+
require explicit delayed-settlement reconciliation before fulfillment.
|
|
49
|
+
- Clarified Micro / Nano unsettled-exposure scope and terminal states across
|
|
50
|
+
pricing, announcement, lifecycle, troubleshooting, and API reference docs.
|
|
51
|
+
- Added readiness negative tests and webhook API client tests.
|
|
52
|
+
|
|
3
53
|
## 0.4.19 - 2026-06-20
|
|
4
54
|
|
|
5
55
|
Make the 10-minute integration path a real product-integration path instead of
|
package/README.md
CHANGED
|
@@ -86,6 +86,8 @@ CLI-first:
|
|
|
86
86
|
|
|
87
87
|
```bash
|
|
88
88
|
npm install @siglume/direct-request-payment
|
|
89
|
+
npx siglume-sdrp sandbox --webhook-url http://localhost:3000/payments/webhooks/siglume
|
|
90
|
+
npx siglume-check readiness --sandbox
|
|
89
91
|
npx siglume-check readiness
|
|
90
92
|
npx siglume-sdrp init express --target src/siglume
|
|
91
93
|
```
|
|
@@ -97,8 +99,12 @@ pip install siglume-direct-request-payment
|
|
|
97
99
|
siglume-sdrp init fastapi --target app/siglume
|
|
98
100
|
```
|
|
99
101
|
|
|
100
|
-
The
|
|
101
|
-
|
|
102
|
+
The sandbox command starts a local Siglume-compatible API that creates fake
|
|
103
|
+
checkout sessions and sends signed webhooks to your product. It never charges a
|
|
104
|
+
wallet; see [SDRP Sandbox](./docs/sandbox.md). The readiness command checks
|
|
105
|
+
account, billing, origin, webhook, and Hosted Checkout availability before you
|
|
106
|
+
write checkout code. It also confirms the webhook subscription and signed test
|
|
107
|
+
delivery when API probes are enabled.
|
|
102
108
|
|
|
103
109
|
Before implementation, confirm Hosted Checkout readiness in
|
|
104
110
|
[Troubleshooting](./docs/troubleshooting.md#hosted-checkout-readiness). For
|
|
@@ -119,8 +125,8 @@ fulfilling orders.
|
|
|
119
125
|
|
|
120
126
|
| Use case | Recommended path | 10-minute integration path? | Production work still required |
|
|
121
127
|
| --- | --- | --- | --- |
|
|
122
|
-
| EC one-time Standard payment | Hosted Checkout | Yes, with `siglume-check readiness` and `siglume-sdrp init` |
|
|
123
|
-
| Game consumables | Hosted Checkout or agent/API | Conditional | Idempotent entitlement grants, disconnect recovery, Micro / Nano
|
|
128
|
+
| EC one-time Standard payment | Hosted Checkout | Yes, with `siglume-check readiness` and `siglume-sdrp init` | Product DB adapter, refund/support process, monitoring |
|
|
129
|
+
| Game consumables | Hosted Checkout or agent/API | Conditional | Idempotent entitlement grants, disconnect recovery, Micro / Nano settlement reconciliation and past-due handling |
|
|
124
130
|
| Paid API / AtoA | Direct API or Siglume marketplace tool | Conditional | Request idempotency, buyer auth context, reconciliation |
|
|
125
131
|
| SaaS subscription | Recurring challenge plus raw API | No | Renewal, cancellation, failed renewal, plan-change lifecycle |
|
|
126
132
|
| Scheduled autopay | Recurring challenge plus schedule token | No | Scheduler, token custody, budget failure handling |
|
|
@@ -171,8 +177,8 @@ redirect(session.checkout_url); // -> https://siglume.com/pay/<session_id>
|
|
|
171
177
|
|
|
172
178
|
// 3. Handle the signed direct_payment.confirmed webhook. Use
|
|
173
179
|
// classifyDirectPaymentConfirmation(event). Fulfill Standard only for
|
|
174
|
-
// standard_settled
|
|
175
|
-
//
|
|
180
|
+
// standard_settled. Do not fulfill metered_usage_accepted unless you have
|
|
181
|
+
// explicitly enabled Micro / Nano settlement reconciliation.
|
|
176
182
|
// Poll merchant.getCheckoutSession(session.session_id) if you also want to
|
|
177
183
|
// show status in your own UI.
|
|
178
184
|
```
|
|
@@ -206,8 +212,8 @@ redirect(session["checkout_url"]) # -> https://siglume.com/pay/<session_id>
|
|
|
206
212
|
|
|
207
213
|
# 3. Handle the signed direct_payment.confirmed webhook. Use
|
|
208
214
|
# classify_direct_payment_confirmation(event). Fulfill Standard only for
|
|
209
|
-
# standard_settled
|
|
210
|
-
#
|
|
215
|
+
# standard_settled. Do not fulfill metered_usage_accepted unless you have
|
|
216
|
+
# explicitly enabled Micro / Nano settlement reconciliation.
|
|
211
217
|
# Poll merchant.get_checkout_session(session["session_id"]) if you also want
|
|
212
218
|
# to show status in your own UI.
|
|
213
219
|
```
|
|
@@ -631,7 +637,8 @@ if (event.type === "direct_payment.confirmed") {
|
|
|
631
637
|
} else if (confirmation.kind === "standard_settled") {
|
|
632
638
|
// Mark the order paid once if event.data.challenge_hash/order mapping matches.
|
|
633
639
|
} else if (confirmation.kind === "metered_usage_accepted") {
|
|
634
|
-
//
|
|
640
|
+
// Default Standard-only integrations should not fulfill this.
|
|
641
|
+
// Enable Micro / Nano only with settlement reconciliation and past-due handling.
|
|
635
642
|
} else {
|
|
636
643
|
// Route confirmation.reason to manual review. Do not mark paid or fulfilled.
|
|
637
644
|
}
|
|
@@ -662,7 +669,8 @@ if verified["event"]["type"] == "direct_payment.confirmed":
|
|
|
662
669
|
# Mark the order paid once if event.data.challenge_hash/order mapping matches.
|
|
663
670
|
pass
|
|
664
671
|
elif confirmation["kind"] == "metered_usage_accepted":
|
|
665
|
-
#
|
|
672
|
+
# Default Standard-only integrations should not fulfill this.
|
|
673
|
+
# Enable Micro / Nano only with settlement reconciliation and past-due handling.
|
|
666
674
|
pass
|
|
667
675
|
else:
|
|
668
676
|
# Route confirmation["reason"] to manual review. Do not mark paid or fulfilled.
|