@plumbus/payments-stripe 0.2.0 → 0.2.2
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 +14 -0
- package/README.md +91 -4
- package/dist/.tsbuildinfo +1 -1
- package/dist/diagnose.d.ts +12 -1
- package/dist/diagnose.d.ts.map +1 -1
- package/dist/diagnose.js +42 -16
- package/dist/diagnose.js.map +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +11 -1
- package/dist/errors.js.map +1 -1
- package/dist/events.d.ts +6 -0
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +11 -3
- package/dist/events.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +10 -3
- package/dist/provider.js.map +1 -1
- package/instructions/webhooks.md +2 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.2 — 2026-10-08
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- The README now uses the standard Plumbus package format (badges, Why?, What you get, When to use this vs alternatives, Status, Configuration, Key gotchas, Links), keeping all of its earlier content. Runtime behavior, the pinned Stripe API version, and peer dependencies are unchanged from 0.2.1.
|
|
8
|
+
|
|
9
|
+
## 0.2.1 — 2026-09-28
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- A customer Stripe no longer has (`resource_missing` on `customer`, or "No such customer") is reported with `reason: 'payments_provider_customer_missing'` instead of `stripe_error`, so `@plumbus/payments` 0.2.1 replaces the billing customer and retries instead of failing every checkout after a switch of Stripe account.
|
|
14
|
+
|
|
15
|
+
- A platform without sellers (only `billing`, e.g. one-off purchases) no longer needs Stripe Connect. `plumbus payments webhooks setup` created a snapshot destination taking events from `@accounts` and a thin destination for v2 account events, and `doctor --live` reported an error when the key could not use Accounts v2 and warned when fewer than two signing secrets were set. Neither applies to an account with no connected accounts. Now, when the config has no `seller` (passed by `@plumbus/payments` 0.2.1 as `sellers: false`), setup creates one snapshot destination from `@self` with the platform's events (`STRIPE_PLATFORM_SNAPSHOT_EVENTS`: no transfer or payout events), and doctor checks only that destination and one signing secret, and skips the Accounts v2 check. Apps with sellers, and callers that do not pass `sellers`, get the two destinations as before.
|
|
16
|
+
|
|
3
17
|
## 0.2.0 — 2026-09-27
|
|
4
18
|
|
|
5
19
|
### Added
|
package/README.md
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
# @plumbus/payments-stripe
|
|
2
2
|
|
|
3
|
-
Stripe provider for [`@plumbus/payments`](../payments/),
|
|
3
|
+
> **Stripe for [Plumbus](https://github.com/plumbus-framework/plumbus) payments.** The Stripe provider for [`@plumbus/payments`](../payments/): Connect for sellers, Checkout, invoices, subscriptions, and Stripe Billing for your own plans, on Stripe's newest APIs.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@plumbus/payments-stripe)
|
|
6
|
+
[](https://github.com/plumbus-framework/plumbus/blob/main/LICENSE)
|
|
7
|
+
[](https://www.npmjs.com/package/@plumbus/core)
|
|
8
|
+
[](https://www.npmjs.com/package/@plumbus/payments)
|
|
9
|
+
|
|
10
|
+
## What is this?
|
|
11
|
+
|
|
12
|
+
[Plumbus](https://github.com/plumbus-framework/plumbus) is an **AI-native, contract-driven TypeScript application framework**. [`@plumbus/payments`](../payments/) is its provider-neutral payments add-on: money moves through capabilities, provider state is mirrored into entities, and apps react to `payments.*` events.
|
|
13
|
+
|
|
14
|
+
`@plumbus/payments-stripe` is the **Stripe provider** for [`@plumbus/payments`](../payments/), built on Stripe's newest APIs:
|
|
4
15
|
|
|
5
16
|
- sellers are **Accounts v2** connected accounts (full, Express, or no Stripe dashboard — your choice per app, the seller's choice per account), with the merchant and/or recipient configuration their charge type needs;
|
|
6
17
|
- clients pay through **Checkout** (hosted or embedded) on the seller's own account (direct charges) or on your platform paid on to the seller (destination charges), with your application fee — or by invoice, saved card, payment link, or subscription;
|
|
@@ -9,7 +20,41 @@ Stripe provider for [`@plumbus/payments`](../payments/), built on Stripe's newes
|
|
|
9
20
|
|
|
10
21
|
Pinned to Stripe API version **`2026-08-26.dahlia`** through the official `stripe` SDK (a dependency — do not add `stripe` to your app).
|
|
11
22
|
|
|
12
|
-
|
|
23
|
+
## Why?
|
|
24
|
+
|
|
25
|
+
`@plumbus/payments` defines what an app can do with money; a provider package does the vendor calls. Keeping Stripe in its own package means the payments contract stays provider-neutral, apps without Stripe never load its SDK, and Stripe's rules (Connect liability, API version, webhook formats) are checked in one place:
|
|
26
|
+
|
|
27
|
+
- Connect rules are enforced when the app starts, and Stripe's recommendations are reported as warnings.
|
|
28
|
+
- `plumbus payments webhooks setup` creates the event destinations this package needs, and `plumbus payments doctor --live` checks keys, Accounts v2 access, destinations, events, the API version, and the billing catalog.
|
|
29
|
+
- `plumbus payments catalog sync` turns the `billing` config into Stripe products, prices, features, and meters.
|
|
30
|
+
|
|
31
|
+
## What you get
|
|
32
|
+
|
|
33
|
+
| Surface | What it does |
|
|
34
|
+
|---|---|
|
|
35
|
+
| `stripeProvider(options)` | The `@plumbus/payments` provider for `createPayments({ provider })`. `(await provider.client())` returns the configured `Stripe` instance for Stripe-only reads. |
|
|
36
|
+
| Sellers | Accounts v2 connected accounts, v2 Account Links onboarding, Account Sessions for embedded components, Express login links. |
|
|
37
|
+
| Payments | Checkout (hosted and embedded, custom amounts, holds, saving the card), invoices, off-session charges on saved cards, payment links, subscriptions, refunds, dispute evidence. |
|
|
38
|
+
| Money movement | Direct, destination, and platform charges; transfers and reversals; payout schedules through Balance Settings and instant payouts. |
|
|
39
|
+
| Stripe Billing | Catalog sync and check (products, prices by lookup key, entitlement features, meters), billing customers, active entitlements, meter events. |
|
|
40
|
+
| Webhooks | Snapshot and thin event verification against several signing secrets; `STRIPE_SNAPSHOT_EVENTS`, `STRIPE_THIN_EVENTS`, `STRIPE_DESTINATION_NAMES`. |
|
|
41
|
+
| `@plumbus/payments-stripe/testing` | `signStripeWebhook`, `stripeSnapshotEvent`, `stripeThinAccountEvent`, `createStripeHttpStub`. |
|
|
42
|
+
|
|
43
|
+
## When to use this vs alternatives
|
|
44
|
+
|
|
45
|
+
| You want | Reach for |
|
|
46
|
+
|---|---|
|
|
47
|
+
| Stripe Connect sellers and Stripe Billing plans in a Plumbus app | **`@plumbus/payments-stripe`** (this package) with [`@plumbus/payments`](../payments/) |
|
|
48
|
+
| Another payment provider | A package implementing the `PaymentProvider` contract from `@plumbus/payments` |
|
|
49
|
+
| App tests without Stripe | The fake provider in `@plumbus/payments/testing` |
|
|
50
|
+
| Stripe request shapes and signed events in tests | `@plumbus/payments-stripe/testing` |
|
|
51
|
+
| Stripe-only reads the neutral API does not cover | `(await provider.client())`, never for creating charges, refunds, transfers, subscriptions, or accounts |
|
|
52
|
+
|
|
53
|
+
## Status
|
|
54
|
+
|
|
55
|
+
Stripe provider for `@plumbus/payments`, version `0.2.2` (version-locked **`0.2.x`**); peers `@plumbus/core` **`0.7.x`** and `@plumbus/payments` **`0.2.x`**; `stripe` 22.x is a dependency. A platform without sellers (billing only) needs no Stripe Connect with `@plumbus/payments` 0.2.1+. Tested offline with Stripe-signed events and an HTTP stub, and end to end on the real Plumbus runtime against a local Stripe simulator by [`examples/payments-connect-app`](../../examples/payments-connect-app/) (28 scenarios).
|
|
56
|
+
|
|
57
|
+
Not supported, by design: OAuth "connect an existing Stripe account" (v1-only), legacy Standard/Express/Custom account types, and private-preview features.
|
|
13
58
|
|
|
14
59
|
## Install
|
|
15
60
|
|
|
@@ -17,7 +62,16 @@ Peers: `@plumbus/core` **`0.7.x`**, `@plumbus/payments` **`0.2.x`**.
|
|
|
17
62
|
pnpm add @plumbus/payments @plumbus/payments-stripe
|
|
18
63
|
```
|
|
19
64
|
|
|
20
|
-
|
|
65
|
+
Peers: `@plumbus/core` **`0.7.x`**, `@plumbus/payments` **`0.2.x`**. Copy them literally; see `node_modules/@plumbus/core/instructions/peer-dependencies.md`.
|
|
66
|
+
|
|
67
|
+
If agent wiring predates the payments instructions, refresh:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
plumbus init --patch --agent all
|
|
71
|
+
plumbus doctor
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Quick start
|
|
21
75
|
|
|
22
76
|
```ts
|
|
23
77
|
import { stripeProvider } from '@plumbus/payments-stripe';
|
|
@@ -36,7 +90,32 @@ plumbus payments catalog sync # with billing: products, prices, features, me
|
|
|
36
90
|
plumbus payments doctor --live --webhook-url https://api.example.com/payments/webhooks/stripe
|
|
37
91
|
```
|
|
38
92
|
|
|
39
|
-
|
|
93
|
+
## Configuration
|
|
94
|
+
|
|
95
|
+
| Option | Default | Notes |
|
|
96
|
+
| --- | --- | --- |
|
|
97
|
+
| `secretKey` | required | `sk_…` or restricted `rk_…` key, or a function returning it; the key prefix sets live or test mode |
|
|
98
|
+
| `webhookSecrets` | required | Signing secrets of every event destination (and old ones during a rotation), or a function returning them |
|
|
99
|
+
| `publishableKey` | none | Embedded payment pages and Connect embedded components |
|
|
100
|
+
| `webhookToleranceSeconds` | `300` | Seconds a signature timestamp may be old |
|
|
101
|
+
| `maxNetworkRetries` | `2` | SDK retries on network errors and 409/429/5xx |
|
|
102
|
+
| `timeoutMs` | `80000` | Request timeout (Stripe's default) |
|
|
103
|
+
| `api` | Stripe | Advanced: another host, such as stripe-mock |
|
|
104
|
+
| `httpClient` | Stripe SDK | Advanced/testing: a custom HTTP client (see `/testing`) |
|
|
105
|
+
|
|
106
|
+
Keys, dashboards, charge types, liability, restricted-key permissions, payouts, and the billing catalog: [`instructions/configure-stripe.md`](./instructions/configure-stripe.md).
|
|
107
|
+
|
|
108
|
+
## Key gotchas
|
|
109
|
+
|
|
110
|
+
- **Liability rules fail at startup.** Stripe's Connect rules are checked when the app starts: Express sellers require your platform to pay fees and cover losses; platform-covered losses always require platform-paid fees. Stripe's recommendations (destination charges for Express and no-dashboard sellers) are reported as warnings.
|
|
111
|
+
- **Do not add `stripe` to your app.** The SDK is this package's dependency; app code calls the payments capabilities and helpers.
|
|
112
|
+
- **Keys are read on first use.** Pass `secretKey` and `webhookSecrets` as functions reading env or a secret manager. Events from the other mode (live or test) are ignored.
|
|
113
|
+
- **Both processes need the secret key.** The API and the worker need `STRIPE_SECRET_KEY` (the worker re-reads Stripe for every webhook); the API also needs `STRIPE_WEBHOOK_SECRETS`.
|
|
114
|
+
- **Each destination signs with its own secret.** Pass every secret in `webhookSecrets`, plus the old ones during a rotation.
|
|
115
|
+
- **Only objects created through this package are tracked.** Payments a seller makes in their own dashboard are ignored (their refunds and disputes too, unless the charge is ours), and so are platform objects without this package's metadata.
|
|
116
|
+
- **Run `plumbus payments catalog sync` after changing `billing`.** Subscriptions find their prices by lookup key; a missing one fails with `stripe_price_missing`.
|
|
117
|
+
- **Express moves Stripe's fees to you.** Your platform pays Stripe's processing and Connect fees and covers losses; set `platformFee` to include Stripe's fee.
|
|
118
|
+
- **A test key in production is an error.** `doctor` reports a `sk_test_`/`rk_test_` key with `NODE_ENV=production`.
|
|
40
119
|
|
|
41
120
|
## Documentation
|
|
42
121
|
|
|
@@ -56,5 +135,13 @@ Stripe's Connect rules are checked when the app starts: Express sellers require
|
|
|
56
135
|
|
|
57
136
|
## Links
|
|
58
137
|
|
|
138
|
+
- **Plumbus framework** — [github.com/plumbus-framework/plumbus](https://github.com/plumbus-framework/plumbus)
|
|
139
|
+
- **Parent / peer** — [`@plumbus/payments`](../payments/)
|
|
59
140
|
- **Payments docs** — [docs/payments/](../../docs/payments/)
|
|
141
|
+
- **Full documentation** — [docs/](../../docs/) in the monorepo
|
|
142
|
+
- **Top-level README** — [`../../README.md`](../../README.md)
|
|
60
143
|
- **Issues** — [github.com/plumbus-framework/plumbus/issues](https://github.com/plumbus-framework/plumbus/issues)
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
MIT
|