@plumbus/payments-stripe 0.2.0
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 +21 -0
- package/README.md +60 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/catalog.d.ts +14 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +286 -0
- package/dist/catalog.js.map +1 -0
- package/dist/charges.d.ts +64 -0
- package/dist/charges.d.ts.map +1 -0
- package/dist/charges.js +339 -0
- package/dist/charges.js.map +1 -0
- package/dist/config-rules.d.ts +7 -0
- package/dist/config-rules.d.ts.map +1 -0
- package/dist/config-rules.js +87 -0
- package/dist/config-rules.js.map +1 -0
- package/dist/diagnose.d.ts +17 -0
- package/dist/diagnose.d.ts.map +1 -0
- package/dist/diagnose.js +237 -0
- package/dist/diagnose.js.map +1 -0
- package/dist/errors.d.ts +4 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +45 -0
- package/dist/errors.js.map +1 -0
- package/dist/events.d.ts +38 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +167 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/mapping.d.ts +328 -0
- package/dist/mapping.d.ts.map +1 -0
- package/dist/mapping.js +437 -0
- package/dist/mapping.js.map +1 -0
- package/dist/provider.d.ts +33 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +634 -0
- package/dist/provider.js.map +1 -0
- package/dist/resolve.d.ts +10 -0
- package/dist/resolve.d.ts.map +1 -0
- package/dist/resolve.js +171 -0
- package/dist/resolve.js.map +1 -0
- package/dist/secrets.d.ts +7 -0
- package/dist/secrets.d.ts.map +1 -0
- package/dist/secrets.js +33 -0
- package/dist/secrets.js.map +1 -0
- package/dist/testing/index.d.ts +54 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +119 -0
- package/dist/testing/index.js.map +1 -0
- package/instructions/README.md +14 -0
- package/instructions/configure-stripe.md +69 -0
- package/instructions/framework.md +62 -0
- package/instructions/testing.md +41 -0
- package/instructions/webhooks.md +44 -0
- package/package.json +66 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.0 — 2026-09-27
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- First release, in the core 0.7.x family. `stripeProvider()` implements the `@plumbus/payments` provider contract with Stripe Connect on Stripe's newest APIs, pinned to API version `2026-08-26.dahlia` (`stripe` 22.x).
|
|
8
|
+
- Sellers as Accounts v2 connected accounts (merchant configuration, `dashboard`, `defaults.responsibilities`), v2 Account Links onboarding, Account Sessions for embedded components, Express login links.
|
|
9
|
+
- Direct charges through Checkout on the seller account with `application_fee_amount`; customers and refunds on the seller account.
|
|
10
|
+
- Webhooks: snapshot events from connected accounts and thin v2 account events, verified against several signing secrets; fetch-on-event resolution for accounts, checkout sessions, refunds, and disputes.
|
|
11
|
+
- Stripe Connect rules at startup (Express requires platform fees and losses; platform losses require platform fees), warnings for platform liability and Radar limits.
|
|
12
|
+
- `plumbus payments webhooks setup` (two event destinations) and `plumbus payments doctor --live` checks (key mode, Accounts v2 access, destinations, events, API version); with `--webhook-url` it checks the destination at that URL and warns about same-named leftovers.
|
|
13
|
+
- Checkout `expires_at` stays a minute inside Stripe's 30-minute–24-hour window; product names are cut without splitting an emoji (a half surrogate pair made the SDK throw `URI malformed`); fee and refunded amount are reported as unknown when Stripe did not expand them, so an unpaid expired session keeps its stored fee; refund changes follow their charge; `findRefund` looks a refund up by its `plumbus_refund_id` on the seller's account.
|
|
14
|
+
- Stripe errors become PlumbusErrors that keep Stripe's message and codes.
|
|
15
|
+
- Charge types and routing: destination charges on the platform (`transfer_data.destination`, `on_behalf_of`), platform charges (`transfer_group`); accounts ask for the recipient configuration (`stripe_transfers`) as needed and onboarding links cover every applied configuration; `transfersEnabled` from the recipient capability; refunds with `reverse_transfer`.
|
|
16
|
+
- Checkout: line items, custom amounts (a `custom_unit_amount` price), embedded pages (`ui_mode: embedded_page`), holds (`capture_method: manual`), saving the method (`setup_future_usage`), and page options (promotion codes, Stripe Tax with `customer_update.address`, billing address, phone, shipping countries, locale, submit type, statement descriptor suffix); discounts, tax, captured amounts, and saved methods read back from sessions.
|
|
17
|
+
- Invoices (created, filled, finalized, sent; an invoice a crashed attempt left behind is finished, not made twice), off-session charges on saved cards (declines and `authentication_required` become outcomes), capture and cancel, card-saving pages, payment method list/detach, client and billing portals (a portal configuration is made for an account that has none), subscriptions through Checkout (inline prices or catalog prices by lookup key, `application_fee_percent`), payment links, transfers (`source_transaction`) and reversals, payouts through Balance Settings (schedules, delay) and instant payouts, dispute evidence and acceptance.
|
|
18
|
+
- Stripe Billing: `syncCatalog` / `checkCatalog` for products (stable ids), prices by lookup key (`transfer_lookup_key` on a change, the old price archived), entitlement features attached to plan products, and billing meters with metered prices; billing customers, active entitlements, and meter events.
|
|
19
|
+
- Webhooks: one snapshot destination from `@self` and `@accounts` with payment intent, payment method, subscription, invoice, transfer, payout, and entitlement events; recipient thin events; routing hints for platform events; `resolveEvent` for every new object, resolving a payment to the page or invoice it belongs to. `webhooks setup` adds missing events to existing destinations and makes a new snapshot destination when an old one lacks `@self`; `doctor --live` reports missing sources, which duplicate to delete, and an out-of-date catalog.
|
|
20
|
+
- Config rules: Stripe's charge-type recommendations (destination for Express and no-dashboard sellers, direct for full) and platform liability for destination charges as warnings.
|
|
21
|
+
- `@plumbus/payments-stripe/testing`: `signStripeWebhook`, `stripeSnapshotEvent`, `stripeThinAccountEvent`, `createStripeHttpStub`.
|
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @plumbus/payments-stripe
|
|
2
|
+
|
|
3
|
+
Stripe provider for [`@plumbus/payments`](../payments/), built on Stripe's newest APIs:
|
|
4
|
+
|
|
5
|
+
- 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
|
+
- 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;
|
|
7
|
+
- your platform splits payments with **transfers**, sets payout schedules through **Balance Settings**, and bills its own plans with **Stripe Billing** (prices by lookup key, entitlements, meters);
|
|
8
|
+
- account changes arrive as **thin** v2 events and everything else as **snapshot** events from the platform and sellers' accounts, all verified from the raw body.
|
|
9
|
+
|
|
10
|
+
Pinned to Stripe API version **`2026-08-26.dahlia`** through the official `stripe` SDK (a dependency — do not add `stripe` to your app).
|
|
11
|
+
|
|
12
|
+
Peers: `@plumbus/core` **`0.7.x`**, `@plumbus/payments` **`0.2.x`**.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pnpm add @plumbus/payments @plumbus/payments-stripe
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { stripeProvider } from '@plumbus/payments-stripe';
|
|
24
|
+
|
|
25
|
+
const provider = stripeProvider({
|
|
26
|
+
secretKey: () => process.env.STRIPE_SECRET_KEY ?? '', // sk_… or rk_…
|
|
27
|
+
webhookSecrets: () => (process.env.STRIPE_WEBHOOK_SECRETS ?? '').split(',').filter(Boolean),
|
|
28
|
+
publishableKey: process.env.STRIPE_PUBLISHABLE_KEY, // embedded components only
|
|
29
|
+
});
|
|
30
|
+
// createPayments({ provider, ... }) — see @plumbus/payments
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
plumbus payments webhooks setup --url https://api.example.com/payments/webhooks/stripe
|
|
35
|
+
plumbus payments catalog sync # with billing: products, prices, features, meters
|
|
36
|
+
plumbus payments doctor --live --webhook-url https://api.example.com/payments/webhooks/stripe
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
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.
|
|
40
|
+
|
|
41
|
+
## Documentation
|
|
42
|
+
|
|
43
|
+
- **Human docs:** [`docs/payments/stripe.md`](../../docs/payments/stripe.md), [`docs/payments/webhooks.md`](../../docs/payments/webhooks.md)
|
|
44
|
+
- **Agent recipes:**
|
|
45
|
+
- [`instructions/README.md`](./instructions/README.md) — index
|
|
46
|
+
- [`instructions/framework.md`](./instructions/framework.md) — APIs used, exports, critical rules
|
|
47
|
+
- [`instructions/configure-stripe.md`](./instructions/configure-stripe.md) — keys, dashboards, charge types, liability, payouts, the billing catalog
|
|
48
|
+
- [`instructions/webhooks.md`](./instructions/webhooks.md) — destinations, secrets, local forwarding
|
|
49
|
+
- [`instructions/testing.md`](./instructions/testing.md) — signed events, HTTP stub, test mode
|
|
50
|
+
- **Test app:** [`examples/payments-connect-app`](../../examples/payments-connect-app/) — real Plumbus runtime + local Stripe simulator, 28 end-to-end scenarios
|
|
51
|
+
- **Smoke app:** [`examples/payments-stripe-smoke`](../../examples/payments-stripe-smoke/) — one process, no database
|
|
52
|
+
|
|
53
|
+
## The Plumbus ecosystem
|
|
54
|
+
|
|
55
|
+
`@plumbus/payments-stripe` is one package in the Plumbus framework. For the full list of packages and when to use each, see the [Plumbus monorepo README](https://github.com/plumbus-framework/plumbus#packages).
|
|
56
|
+
|
|
57
|
+
## Links
|
|
58
|
+
|
|
59
|
+
- **Payments docs** — [docs/payments/](../../docs/payments/)
|
|
60
|
+
- **Issues** — [github.com/plumbus-framework/plumbus/issues](https://github.com/plumbus-framework/plumbus/issues)
|