@molecule/api-payments-stripe 1.0.1 → 1.0.3
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/README.md +28 -3
- package/dist/bondAdapter.d.ts.map +1 -1
- package/dist/bondAdapter.js +28 -18
- package/dist/bondAdapter.js.map +1 -1
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/provider.d.ts +7 -0
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +30 -1
- package/dist/provider.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-08-
|
|
6
|
+
Generated: 2026-08-16T14:04:40.246Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/api-payments-stripe
|
|
@@ -21,7 +21,7 @@ Stripe payment provider for molecule.dev.
|
|
|
21
21
|
## Installation
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
npm install @molecule/api-payments-stripe @molecule/api-bond @molecule/api-i18n @molecule/api-jwt @molecule/api-payments @molecule/api-secrets stripe
|
|
24
|
+
npm install @molecule/api-payments-stripe @molecule/api-bond @molecule/api-i18n @molecule/api-jwt @molecule/api-payments @molecule/api-proxy-agent @molecule/api-secrets stripe
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
## API
|
|
@@ -467,6 +467,7 @@ function createCheckoutSession(options: {
|
|
|
467
467
|
successUrl: string
|
|
468
468
|
cancelUrl: string
|
|
469
469
|
customerId?: string
|
|
470
|
+
clientReferenceId?: string
|
|
470
471
|
metadata?: Record<string, string>
|
|
471
472
|
idempotencyKey?: string
|
|
472
473
|
}): Promise<CheckoutSessionResult>
|
|
@@ -477,6 +478,7 @@ function createCheckoutSession(options: {
|
|
|
477
478
|
- `options.successUrl` — URL to redirect to after successful payment.
|
|
478
479
|
- `options.cancelUrl` — URL to redirect to if the user cancels.
|
|
479
480
|
- `options.customerId` — Optional existing Stripe Customer ID.
|
|
481
|
+
- `options.clientReferenceId` — Your own id for the buyer (the app's user id). Stripe echoes it back as `client_reference_id` on the session and on every `checkout.session.*` webhook event, which is how the customer (`cus_…`) created by this checkout gets linked to the account that paid. Always pass it: without it the first purchase has nothing tying the new Stripe customer to a user.
|
|
480
482
|
- `options.metadata` — Optional key-value metadata to attach to the session.
|
|
481
483
|
- `options.idempotencyKey` — Optional idempotency key for safe request retries.
|
|
482
484
|
|
|
@@ -814,7 +816,7 @@ Peer dependencies:
|
|
|
814
816
|
|
|
815
817
|
- `@molecule/api-bond` ^1.0.1
|
|
816
818
|
- `@molecule/api-i18n` ^1.0.1
|
|
817
|
-
- `@molecule/api-payments` ^1.0
|
|
819
|
+
- `@molecule/api-payments` ^1.1.0
|
|
818
820
|
- `@molecule/api-jwt` ^1.0.1
|
|
819
821
|
- `@molecule/api-secrets` ^1.0.1
|
|
820
822
|
|
|
@@ -835,6 +837,7 @@ Peer dependencies:
|
|
|
835
837
|
- `@molecule/api-i18n`
|
|
836
838
|
- `@molecule/api-jwt`
|
|
837
839
|
- `@molecule/api-payments`
|
|
840
|
+
- `@molecule/api-proxy-agent`
|
|
838
841
|
- `@molecule/api-secrets`
|
|
839
842
|
- `stripe`
|
|
840
843
|
|
|
@@ -881,6 +884,19 @@ Two things a weak Stripe integration gets wrong:
|
|
|
881
884
|
Create checkout with SERVER-configured price ids ({@link createCheckoutSession}) — never an
|
|
882
885
|
amount sent by the client.
|
|
883
886
|
|
|
887
|
+
**Checkout returns the buyer to the APP, and the session must name the buyer.**
|
|
888
|
+
`paymentProvider.updateSubscription` builds `success_url` /`cancel_url` with
|
|
889
|
+
`resolveCheckoutRedirectUrls` from `@molecule/api-payments`, so Stripe returns to
|
|
890
|
+
`APP_ORIGIN/plan-updated?provider=stripe&sessionId={CHECKOUT_SESSION_ID}` — the page
|
|
891
|
+
then calls `POST /users/:id/verify-payment/stripe` with that id from an origin whose
|
|
892
|
+
cookies authenticate. Returning to a separate API host instead sends a top-level
|
|
893
|
+
redirect with NO credentials, so the callback answers 401 and the paid plan is never
|
|
894
|
+
granted. It also sets `client_reference_id` + `metadata.userId` to the app's user id;
|
|
895
|
+
they are how a webhook links the newly created `cus_…` to the account that paid on a
|
|
896
|
+
FIRST purchase, and without them nothing ever writes the customer id — so any
|
|
897
|
+
usage/metered billing keyed on it can never charge. Pass `clientReferenceId` when you
|
|
898
|
+
call {@link createCheckoutSession} yourself.
|
|
899
|
+
|
|
884
900
|
**A missing `STRIPE_SECRET_KEY` is NOT the same as "no active subscription."**
|
|
885
901
|
`getClient()` throws a tagged config-not-configured error; `verifySubscription`,
|
|
886
902
|
`updateSubscription`, and `cancelSubscription` on {@link paymentProvider} detect
|
|
@@ -891,6 +907,15 @@ own catch block) can tell "the operator forgot to set the secret" apart from
|
|
|
891
907
|
"this subscription/card is invalid" and surface the actionable 503 instead of
|
|
892
908
|
a generic 400/500.
|
|
893
909
|
|
|
910
|
+
**Runs behind an outbound proxy when `HTTPS_PROXY` is set.** The `stripe` SDK
|
|
911
|
+
builds its own agent and reads no proxy variable, so on a host whose only
|
|
912
|
+
egress path is a proxy every call used to fail with a bare connection error.
|
|
913
|
+
This bond now passes a CONNECT-capable agent into the SDK's `httpAgent` hook
|
|
914
|
+
(`@molecule/api-proxy-agent`, resolved against `https://api.stripe.com` so
|
|
915
|
+
`NO_PROXY` is honoured). With no proxy configured nothing is passed and the
|
|
916
|
+
SDK keeps its own default agent — a standalone app behaves exactly as before.
|
|
917
|
+
Allowlist `api.stripe.com` on the proxy.
|
|
918
|
+
|
|
894
919
|
## E2E Tests
|
|
895
920
|
|
|
896
921
|
Integration checklist — drive the real UI (live preview, no mocks; use the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bondAdapter.d.ts","sourceRoot":"","sources":["../src/bondAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,OAAO,EAGL,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"bondAdapter.d.ts","sourceRoot":"","sources":["../src/bondAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,OAAO,EAGL,KAAK,eAAe,EAQrB,MAAM,wBAAwB,CAAA;AA6C/B;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,EAAE,eAwa7B,CAAA"}
|
package/dist/bondAdapter.js
CHANGED
|
@@ -10,7 +10,7 @@ import crypto from 'crypto';
|
|
|
10
10
|
import { getLogger } from '@molecule/api-bond';
|
|
11
11
|
const logger = getLogger();
|
|
12
12
|
import { get } from '@molecule/api-bond';
|
|
13
|
-
import { isConfigNotConfiguredError, } from '@molecule/api-payments';
|
|
13
|
+
import { isConfigNotConfiguredError, resolveCheckoutRedirectUrls, } from '@molecule/api-payments';
|
|
14
14
|
import { createCheckoutSession, createPortalSession as stripeCreatePortalSession, createSetupIntent as stripeCreateSetupIntent, detachPaymentMethod as stripeDetachPaymentMethod, getCheckoutSession, getSubscription, normalizeSubscription, normalizeSubscriptionStatus, retrievePaymentMethod as stripeRetrievePaymentMethod, updateSubscription as stripeUpdateSubscription, verifyWebhookSignature, } from './provider.js';
|
|
15
15
|
/**
|
|
16
16
|
* Maps Stripe webhook event types (e.g. `customer.subscription.created`) to
|
|
@@ -212,6 +212,10 @@ export const paymentProvider = {
|
|
|
212
212
|
* 1. Looks up the user's existing Stripe subscription via PaymentRecordService.
|
|
213
213
|
* 2. If found, updates the subscription to the new product/price.
|
|
214
214
|
* 3. If not found, creates a Stripe Checkout session and returns the checkout URL.
|
|
215
|
+
* The session returns the buyer to the APP's `/plan-updated` page (never the
|
|
216
|
+
* API host — see `resolveCheckoutRedirectUrls`) and carries the user id as
|
|
217
|
+
* `client_reference_id` + `metadata.userId` so the resulting customer can be
|
|
218
|
+
* linked to the account that paid.
|
|
215
219
|
*
|
|
216
220
|
* Handles subscription updates and new checkout session creation.
|
|
217
221
|
* @param params - The update parameters.
|
|
@@ -256,21 +260,20 @@ export const paymentProvider = {
|
|
|
256
260
|
}
|
|
257
261
|
}
|
|
258
262
|
// No existing subscription — create a Stripe Checkout session.
|
|
259
|
-
//
|
|
260
|
-
//
|
|
261
|
-
//
|
|
262
|
-
//
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
//
|
|
266
|
-
//
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
logger.warn(`Stripe checkout: API_ORIGIN/APP_ORIGIN/ORIGIN not set — falling back to ${fallbackApiOrigin} / ${fallbackAppOrigin} for redirect URLs (fine in dev, wrong in production).`);
|
|
263
|
+
// Both redirect URLs point at the APP origin: the session cookie is set
|
|
264
|
+
// for the app's host, so a top-level return to a separate API host
|
|
265
|
+
// carries no credentials and the authenticated verify route answers 401
|
|
266
|
+
// (the buyer pays and lands on an error page). The app's
|
|
267
|
+
// `/plan-updated` page verifies with the `cs_…` id from the query
|
|
268
|
+
// instead. Stripe rejects empty/relative URLs with `code: 'url_invalid'`,
|
|
269
|
+
// so an unset APP_ORIGIN/ORIGIN falls back to localhost — fine in dev,
|
|
270
|
+
// and warned about because it strands a deployed buyer.
|
|
271
|
+
const redirects = resolveCheckoutRedirectUrls({
|
|
272
|
+
provider: 'stripe',
|
|
273
|
+
sessionIdToken: '{CHECKOUT_SESSION_ID}',
|
|
274
|
+
});
|
|
275
|
+
if (redirects.usingFallbackOrigin) {
|
|
276
|
+
logger.warn(`Stripe checkout: APP_ORIGIN/ORIGIN not set — falling back to ${redirects.appOrigin} for redirect URLs (fine in dev, wrong in production).`);
|
|
274
277
|
}
|
|
275
278
|
// Generate idempotency key from userId + priceId + timestamp window (5-min buckets)
|
|
276
279
|
// This prevents duplicate checkout sessions if the user double-clicks or retries
|
|
@@ -281,8 +284,15 @@ export const paymentProvider = {
|
|
|
281
284
|
.digest('hex');
|
|
282
285
|
const session = await createCheckoutSession({
|
|
283
286
|
priceId: params.newProductId,
|
|
284
|
-
successUrl:
|
|
285
|
-
cancelUrl:
|
|
287
|
+
successUrl: redirects.successUrl,
|
|
288
|
+
cancelUrl: redirects.cancelUrl,
|
|
289
|
+
// Bind the session to the buying account BOTH ways Stripe echoes an
|
|
290
|
+
// app-side id back (top-level on `checkout.session.*`, and in
|
|
291
|
+
// `metadata` on objects that carry no client_reference_id). This is
|
|
292
|
+
// what lets a webhook link the new `cus_…` to the user on a FIRST
|
|
293
|
+
// purchase, before any customer id is stored.
|
|
294
|
+
clientReferenceId: params.userId,
|
|
295
|
+
metadata: { userId: params.userId },
|
|
286
296
|
idempotencyKey,
|
|
287
297
|
});
|
|
288
298
|
if (session?.id && session?.url) {
|
package/dist/bondAdapter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bondAdapter.js","sourceRoot":"","sources":["../src/bondAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;AAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAA;AACxC,OAAO,EAEL,0BAA0B,
|
|
1
|
+
{"version":3,"file":"bondAdapter.js","sourceRoot":"","sources":["../src/bondAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;AAC1B,OAAO,EAAE,GAAG,EAAE,MA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;CACF,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -47,6 +47,19 @@
|
|
|
47
47
|
* Create checkout with SERVER-configured price ids ({@link createCheckoutSession}) — never an
|
|
48
48
|
* amount sent by the client.
|
|
49
49
|
*
|
|
50
|
+
* **Checkout returns the buyer to the APP, and the session must name the buyer.**
|
|
51
|
+
* `paymentProvider.updateSubscription` builds `success_url` /`cancel_url` with
|
|
52
|
+
* `resolveCheckoutRedirectUrls` from `@molecule/api-payments`, so Stripe returns to
|
|
53
|
+
* `APP_ORIGIN/plan-updated?provider=stripe&sessionId={CHECKOUT_SESSION_ID}` — the page
|
|
54
|
+
* then calls `POST /users/:id/verify-payment/stripe` with that id from an origin whose
|
|
55
|
+
* cookies authenticate. Returning to a separate API host instead sends a top-level
|
|
56
|
+
* redirect with NO credentials, so the callback answers 401 and the paid plan is never
|
|
57
|
+
* granted. It also sets `client_reference_id` + `metadata.userId` to the app's user id;
|
|
58
|
+
* they are how a webhook links the newly created `cus_…` to the account that paid on a
|
|
59
|
+
* FIRST purchase, and without them nothing ever writes the customer id — so any
|
|
60
|
+
* usage/metered billing keyed on it can never charge. Pass `clientReferenceId` when you
|
|
61
|
+
* call {@link createCheckoutSession} yourself.
|
|
62
|
+
*
|
|
50
63
|
* **A missing `STRIPE_SECRET_KEY` is NOT the same as "no active subscription."**
|
|
51
64
|
* `getClient()` throws a tagged config-not-configured error; `verifySubscription`,
|
|
52
65
|
* `updateSubscription`, and `cancelSubscription` on {@link paymentProvider} detect
|
|
@@ -57,6 +70,15 @@
|
|
|
57
70
|
* "this subscription/card is invalid" and surface the actionable 503 instead of
|
|
58
71
|
* a generic 400/500.
|
|
59
72
|
*
|
|
73
|
+
* **Runs behind an outbound proxy when `HTTPS_PROXY` is set.** The `stripe` SDK
|
|
74
|
+
* builds its own agent and reads no proxy variable, so on a host whose only
|
|
75
|
+
* egress path is a proxy every call used to fail with a bare connection error.
|
|
76
|
+
* This bond now passes a CONNECT-capable agent into the SDK's `httpAgent` hook
|
|
77
|
+
* (`@molecule/api-proxy-agent`, resolved against `https://api.stripe.com` so
|
|
78
|
+
* `NO_PROXY` is honoured). With no proxy configured nothing is passed and the
|
|
79
|
+
* SDK keeps its own default agent — a standalone app behaves exactly as before.
|
|
80
|
+
* Allowlist `api.stripe.com` on the proxy.
|
|
81
|
+
*
|
|
60
82
|
* @module
|
|
61
83
|
*/
|
|
62
84
|
export * from './bondAdapter.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkFG;AAEH,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -47,6 +47,19 @@
|
|
|
47
47
|
* Create checkout with SERVER-configured price ids ({@link createCheckoutSession}) — never an
|
|
48
48
|
* amount sent by the client.
|
|
49
49
|
*
|
|
50
|
+
* **Checkout returns the buyer to the APP, and the session must name the buyer.**
|
|
51
|
+
* `paymentProvider.updateSubscription` builds `success_url` /`cancel_url` with
|
|
52
|
+
* `resolveCheckoutRedirectUrls` from `@molecule/api-payments`, so Stripe returns to
|
|
53
|
+
* `APP_ORIGIN/plan-updated?provider=stripe&sessionId={CHECKOUT_SESSION_ID}` — the page
|
|
54
|
+
* then calls `POST /users/:id/verify-payment/stripe` with that id from an origin whose
|
|
55
|
+
* cookies authenticate. Returning to a separate API host instead sends a top-level
|
|
56
|
+
* redirect with NO credentials, so the callback answers 401 and the paid plan is never
|
|
57
|
+
* granted. It also sets `client_reference_id` + `metadata.userId` to the app's user id;
|
|
58
|
+
* they are how a webhook links the newly created `cus_…` to the account that paid on a
|
|
59
|
+
* FIRST purchase, and without them nothing ever writes the customer id — so any
|
|
60
|
+
* usage/metered billing keyed on it can never charge. Pass `clientReferenceId` when you
|
|
61
|
+
* call {@link createCheckoutSession} yourself.
|
|
62
|
+
*
|
|
50
63
|
* **A missing `STRIPE_SECRET_KEY` is NOT the same as "no active subscription."**
|
|
51
64
|
* `getClient()` throws a tagged config-not-configured error; `verifySubscription`,
|
|
52
65
|
* `updateSubscription`, and `cancelSubscription` on {@link paymentProvider} detect
|
|
@@ -57,6 +70,15 @@
|
|
|
57
70
|
* "this subscription/card is invalid" and surface the actionable 503 instead of
|
|
58
71
|
* a generic 400/500.
|
|
59
72
|
*
|
|
73
|
+
* **Runs behind an outbound proxy when `HTTPS_PROXY` is set.** The `stripe` SDK
|
|
74
|
+
* builds its own agent and reads no proxy variable, so on a host whose only
|
|
75
|
+
* egress path is a proxy every call used to fail with a bare connection error.
|
|
76
|
+
* This bond now passes a CONNECT-capable agent into the SDK's `httpAgent` hook
|
|
77
|
+
* (`@molecule/api-proxy-agent`, resolved against `https://api.stripe.com` so
|
|
78
|
+
* `NO_PROXY` is honoured). With no proxy configured nothing is passed and the
|
|
79
|
+
* SDK keeps its own default agent — a standalone app behaves exactly as before.
|
|
80
|
+
* Allowlist `api.stripe.com` on the proxy.
|
|
81
|
+
*
|
|
60
82
|
* @module
|
|
61
83
|
*/
|
|
62
84
|
export * from './bondAdapter.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkFG;AAEH,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA"}
|
package/dist/provider.d.ts
CHANGED
|
@@ -23,6 +23,12 @@ export declare const getClient: () => Stripe;
|
|
|
23
23
|
* @param options.successUrl - URL to redirect to after successful payment.
|
|
24
24
|
* @param options.cancelUrl - URL to redirect to if the user cancels.
|
|
25
25
|
* @param options.customerId - Optional existing Stripe Customer ID.
|
|
26
|
+
* @param options.clientReferenceId - Your own id for the buyer (the app's user
|
|
27
|
+
* id). Stripe echoes it back as `client_reference_id` on the session and on
|
|
28
|
+
* every `checkout.session.*` webhook event, which is how the customer
|
|
29
|
+
* (`cus_…`) created by this checkout gets linked to the account that paid.
|
|
30
|
+
* Always pass it: without it the first purchase has nothing tying the new
|
|
31
|
+
* Stripe customer to a user.
|
|
26
32
|
* @param options.metadata - Optional key-value metadata to attach to the session.
|
|
27
33
|
* @param options.idempotencyKey - Optional idempotency key for safe request retries.
|
|
28
34
|
* @returns The checkout session ID and URL.
|
|
@@ -32,6 +38,7 @@ export declare const createCheckoutSession: (options: {
|
|
|
32
38
|
successUrl: string;
|
|
33
39
|
cancelUrl: string;
|
|
34
40
|
customerId?: string;
|
|
41
|
+
clientReferenceId?: string;
|
|
35
42
|
metadata?: Record<string, string>;
|
|
36
43
|
idempotencyKey?: string;
|
|
37
44
|
}) => Promise<CheckoutSessionResult>;
|
package/dist/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,MAAM,MAAM,QAAQ,CAAA;AAO3B,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,sBAAsB,E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AAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,cAAc,EAAE,MAAM,CAAA;CACvB,KAAG,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAmB9C,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,GAAI,WAAW,MAAM,GAAG,SAAS,KAAG,kBAa3E,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,GAAI,cAAc,kBAAkB,KAAG,sBAaxE,CAAA"}
|
package/dist/provider.js
CHANGED
|
@@ -12,7 +12,16 @@ const logger = getLogger();
|
|
|
12
12
|
// runtime registry is populated even when provider.js is imported directly
|
|
13
13
|
// (not through the package barrel).
|
|
14
14
|
import './secrets.js';
|
|
15
|
+
import { getProxyAgent } from '@molecule/api-proxy-agent';
|
|
15
16
|
import { configNotConfiguredError } from '@molecule/api-secrets';
|
|
17
|
+
/**
|
|
18
|
+
* The Stripe REST endpoint every request in this bond goes to.
|
|
19
|
+
*
|
|
20
|
+
* Only used to resolve the outbound proxy: the target URL is what decides which
|
|
21
|
+
* proxy variable applies and whether `NO_PROXY` exempts the host, so it has to
|
|
22
|
+
* be the real endpoint rather than a placeholder.
|
|
23
|
+
*/
|
|
24
|
+
const STRIPE_API_URL = 'https://api.stripe.com';
|
|
16
25
|
/**
|
|
17
26
|
* The lazily-initialized `Stripe` instance.
|
|
18
27
|
*
|
|
@@ -35,11 +44,24 @@ export const getClient = () => {
|
|
|
35
44
|
// they're trying to upgrade to a paid plan.
|
|
36
45
|
throw configNotConfiguredError('STRIPE_SECRET_KEY', 'payments');
|
|
37
46
|
}
|
|
47
|
+
// The Stripe SDK builds its own `https.Agent` and does NOT read
|
|
48
|
+
// HTTPS_PROXY/NO_PROXY — `NODE_USE_ENV_PROXY` does not reach it either,
|
|
49
|
+
// because it never goes through Node's proxy-aware paths. On a workstation
|
|
50
|
+
// that direct dial to api.stripe.com succeeds, so the gap is invisible; in
|
|
51
|
+
// an environment whose only egress path is a proxy (a molecule.dev sandbox,
|
|
52
|
+
// a deployed molecule.dev app) every call failed with a bare connection
|
|
53
|
+
// error. `httpAgent` is the SDK's own hook for exactly this. Undefined when
|
|
54
|
+
// no proxy is configured, so a standalone app is unaffected.
|
|
55
|
+
const httpAgent = getProxyAgent(STRIPE_API_URL);
|
|
38
56
|
// Bound each request: Stripe's SDK default is an 80s timeout with automatic
|
|
39
57
|
// retries, so a Stripe slowdown during a signup/upgrade surge would pin
|
|
40
58
|
// request workers for over a minute each and cascade into a pool/worker
|
|
41
59
|
// exhaustion outage. Cap at 15s with two retries.
|
|
42
|
-
_client = new Stripe(key, {
|
|
60
|
+
_client = new Stripe(key, {
|
|
61
|
+
timeout: 15_000,
|
|
62
|
+
maxNetworkRetries: 2,
|
|
63
|
+
...(httpAgent ? { httpAgent } : {}),
|
|
64
|
+
});
|
|
43
65
|
}
|
|
44
66
|
return _client;
|
|
45
67
|
};
|
|
@@ -83,6 +105,12 @@ const toSubscriptionResult = (sub) => {
|
|
|
83
105
|
* @param options.successUrl - URL to redirect to after successful payment.
|
|
84
106
|
* @param options.cancelUrl - URL to redirect to if the user cancels.
|
|
85
107
|
* @param options.customerId - Optional existing Stripe Customer ID.
|
|
108
|
+
* @param options.clientReferenceId - Your own id for the buyer (the app's user
|
|
109
|
+
* id). Stripe echoes it back as `client_reference_id` on the session and on
|
|
110
|
+
* every `checkout.session.*` webhook event, which is how the customer
|
|
111
|
+
* (`cus_…`) created by this checkout gets linked to the account that paid.
|
|
112
|
+
* Always pass it: without it the first purchase has nothing tying the new
|
|
113
|
+
* Stripe customer to a user.
|
|
86
114
|
* @param options.metadata - Optional key-value metadata to attach to the session.
|
|
87
115
|
* @param options.idempotencyKey - Optional idempotency key for safe request retries.
|
|
88
116
|
* @returns The checkout session ID and URL.
|
|
@@ -101,6 +129,7 @@ export const createCheckoutSession = async (options) => {
|
|
|
101
129
|
success_url: options.successUrl,
|
|
102
130
|
cancel_url: options.cancelUrl,
|
|
103
131
|
customer: options.customerId,
|
|
132
|
+
client_reference_id: options.clientReferenceId,
|
|
104
133
|
metadata: options.metadata,
|
|
105
134
|
}, options.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : undefined);
|
|
106
135
|
return { id: session.id, url: session.url };
|
package/dist/provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;AAC1B,sEAAsE;AACtE,2EAA2E;AAC3E,oCAAoC;AACpC,OAAO,cAAc,CAAA;AAGrB,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAShE;;;;GAIG;AACH,IAAI,OAAO,GAAkB,IAAI,CAAA;AAEjC;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,GAAW,EAAE;IACpC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAA;QACzC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,2EAA2E;YAC3E,4EAA4E;YAC5E,yEAAyE;YACzE,yEAAyE;YACzE,4CAA4C;YAC5C,MAAM,wBAAwB,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAA;QACjE,CAAC;QACD,4EAA4E;QAC5E,wEAAwE;QACxE,wEAAwE;QACxE,kDAAkD;QAClD,OAAO,GAAG,IAAI,MAAM,CAAC,GAAG,EAAE,
|
|
1
|
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AE,UAAU;QACpB,UAAU,EAAE,SAAS;QACrB,kBAAkB,EAAE,SAAS;QAC7B,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,QAAQ;QAChB,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,UAAU;KACnB,CAAA;IAED,OAAO,CAAC,SAAS,IAAI,SAAS,CAAC,SAAS,CAAC,CAAC,IAAI,SAAS,CAAA;AACzD,CAAC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,YAAgC,EAA0B,EAAE;IAChG,OAAO;QACL,QAAQ,EAAE,QAAQ;QAClB,cAAc,EAAE,YAAY,CAAC,EAAE;QAC/B,SAAS,EAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAkB,IAAI,EAAE;QACvE,MAAM,EAAE,2BAA2B,CAAC,YAAY,CAAC,MAAM,CAAC;QACxD,QAAQ,EAAE,YAAY,CAAC,MAAM,KAAK,QAAQ,IAAI,YAAY,CAAC,MAAM,KAAK,UAAU;QAChF,kBAAkB,EAAE,YAAY,CAAC,oBAAoB,GAAG,IAAI;QAC5D,gBAAgB,EAAE,YAAY,CAAC,kBAAkB,GAAG,IAAI;QACxD,SAAS,EAAE,CAAC,YAAY,CAAC,oBAAoB;QAC7C,UAAU,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS;QAClF,OAAO,EAAE,YAAkD;KAC5D,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/api-payments-stripe",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Stripe payment provider for molecule.dev.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
],
|
|
28
28
|
"license": "Apache-2.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
+
"@molecule/api-proxy-agent": "1.1.0",
|
|
30
31
|
"stripe": "22.4.0"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
@@ -37,7 +38,7 @@
|
|
|
37
38
|
"peerDependencies": {
|
|
38
39
|
"@molecule/api-bond": "^1.0.1",
|
|
39
40
|
"@molecule/api-i18n": "^1.0.1",
|
|
40
|
-
"@molecule/api-payments": "^1.0
|
|
41
|
+
"@molecule/api-payments": "^1.1.0",
|
|
41
42
|
"@molecule/api-jwt": "^1.0.1",
|
|
42
43
|
"@molecule/api-secrets": "^1.0.1"
|
|
43
44
|
},
|