@molecule/api-payments-stripe 1.0.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/LICENSE +115 -0
- package/dist/bondAdapter.d.ts +18 -0
- package/dist/bondAdapter.d.ts.map +1 -0
- package/dist/bondAdapter.js +406 -0
- package/dist/bondAdapter.js.map +1 -0
- package/dist/browser-guard.d.ts +2 -0
- package/dist/browser-guard.d.ts.map +1 -0
- package/dist/browser-guard.js +19 -0
- package/dist/browser-guard.js.map +1 -0
- package/dist/connect.d.ts +252 -0
- package/dist/connect.d.ts.map +1 -0
- package/dist/connect.js +229 -0
- package/dist/connect.js.map +1 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +68 -0
- package/dist/index.js.map +1 -0
- package/dist/provider.d.ts +204 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +413 -0
- package/dist/provider.js.map +1 -0
- package/dist/secrets.d.ts +16 -0
- package/dist/secrets.d.ts.map +1 -0
- package/dist/secrets.js +32 -0
- package/dist/secrets.js.map +1 -0
- package/dist/types.d.ts +78 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +61 -0
package/dist/secrets.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stripe secret definitions — self-registered at import time so the
|
|
3
|
+
* runtime secrets registry (`@molecule/api-secrets`) can drive boot-time
|
|
4
|
+
* configuration reports and actionable "not configured" errors.
|
|
5
|
+
*
|
|
6
|
+
* Content is derived MECHANICALLY from this package's mlcl registry secrets
|
|
7
|
+
* entry (label/instructions/setupUrl/example) via the fleet formula, so
|
|
8
|
+
* packages sharing a key register byte-identical definitions and
|
|
9
|
+
* registration order never matters.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
import { registerSecrets } from '@molecule/api-secrets';
|
|
14
|
+
/** Secret definitions required by the Stripe payments bond. */
|
|
15
|
+
export const stripeSecretDefinitions = [
|
|
16
|
+
{
|
|
17
|
+
key: 'STRIPE_SECRET_KEY',
|
|
18
|
+
description: 'Stripe secret key — Stripe Dashboard → Developers → API keys; use the sk_test_ key in test mode, sk_live_ in production.',
|
|
19
|
+
helpUrl: 'https://dashboard.stripe.com/apikeys',
|
|
20
|
+
required: true,
|
|
21
|
+
example: 'sk_test_...',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
key: 'STRIPE_WEBHOOK_SECRET',
|
|
25
|
+
description: 'Stripe webhook signing secret — Stripe Dashboard → Developers → Webhooks → Add endpoint pointing at {apiUrl}/api/users/payment-notification/stripe, then copy its signing secret.',
|
|
26
|
+
helpUrl: 'https://dashboard.stripe.com/webhooks',
|
|
27
|
+
required: true,
|
|
28
|
+
example: 'whsec_...',
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
registerSecrets(stripeSecretDefinitions);
|
|
32
|
+
//# sourceMappingURL=secrets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets.js","sourceRoot":"","sources":["../src/secrets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,+DAA+D;AAC/D,MAAM,CAAC,MAAM,uBAAuB,GAAuB;IACzD;QACE,GAAG,EAAE,mBAAmB;QACxB,WAAW,EACT,0HAA0H;QAC5H,OAAO,EAAE,sCAAsC;QAC/C,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,aAAa;KACvB;IACD;QACE,GAAG,EAAE,uBAAuB;QAC5B,WAAW,EACT,mLAAmL;QACrL,OAAO,EAAE,uCAAuC;QAChD,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,WAAW;KACrB;CACF,CAAA;AAED,eAAe,CAAC,uBAAuB,CAAC,CAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for the Stripe payment provider.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
export type { NormalizedPurchase, NormalizedSubscription, PaymentProvider, SubscriptionStatus, } from '@molecule/api-payments';
|
|
7
|
+
/**
|
|
8
|
+
* Result of creating or retrieving a checkout session.
|
|
9
|
+
*/
|
|
10
|
+
export interface CheckoutSessionResult {
|
|
11
|
+
id: string;
|
|
12
|
+
url: string | null;
|
|
13
|
+
/** The Stripe Subscription ID created by the checkout session, if available. */
|
|
14
|
+
subscription?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Normalized subscription data from Stripe.
|
|
18
|
+
*/
|
|
19
|
+
export interface SubscriptionResult {
|
|
20
|
+
id: string;
|
|
21
|
+
status: string;
|
|
22
|
+
/**
|
|
23
|
+
* The Stripe Customer ID (`cus_...`) that owns this subscription. Used to bind
|
|
24
|
+
* a verified subscription to the calling user so a foreign subscription id
|
|
25
|
+
* cannot be claimed (ownership check in `verifyPayment`).
|
|
26
|
+
*/
|
|
27
|
+
customer?: string;
|
|
28
|
+
items: {
|
|
29
|
+
data: Array<{
|
|
30
|
+
id: string;
|
|
31
|
+
price?: {
|
|
32
|
+
id?: string;
|
|
33
|
+
product?: string;
|
|
34
|
+
};
|
|
35
|
+
}>;
|
|
36
|
+
};
|
|
37
|
+
current_period_start: number;
|
|
38
|
+
current_period_end: number;
|
|
39
|
+
cancel_at_period_end: boolean;
|
|
40
|
+
canceled_at: number | null;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Parameters for updating a subscription.
|
|
44
|
+
*/
|
|
45
|
+
export interface SubscriptionUpdateParams {
|
|
46
|
+
items?: Array<{
|
|
47
|
+
id: string;
|
|
48
|
+
price: string;
|
|
49
|
+
}>;
|
|
50
|
+
cancel_at_period_end?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Result of verifying a webhook event.
|
|
54
|
+
*/
|
|
55
|
+
export interface WebhookEventResult {
|
|
56
|
+
type: string;
|
|
57
|
+
data: {
|
|
58
|
+
object: Record<string, unknown>;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
declare global {
|
|
62
|
+
namespace NodeJS {
|
|
63
|
+
/**
|
|
64
|
+
* Process Env interface.
|
|
65
|
+
*/
|
|
66
|
+
interface ProcessEnv {
|
|
67
|
+
/**
|
|
68
|
+
* The key used for Stripe's API.
|
|
69
|
+
*/
|
|
70
|
+
STRIPE_SECRET_KEY?: string;
|
|
71
|
+
/**
|
|
72
|
+
* The Stripe webhook secret for verifying webhook signatures.
|
|
73
|
+
*/
|
|
74
|
+
STRIPE_WEBHOOK_SECRET?: string;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,GACnB,MAAM,wBAAwB,CAAA;AAE/B;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,gFAAgF;IAChF,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE;QAAE,IAAI,EAAE,KAAK,CAAC;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE;gBAAE,EAAE,CAAC,EAAE,MAAM,CAAC;gBAAC,OAAO,CAAC,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE,CAAC,CAAA;KAAE,CAAA;IACjF,oBAAoB,EAAE,MAAM,CAAA;IAC5B,kBAAkB,EAAE,MAAM,CAAA;IAC1B,oBAAoB,EAAE,OAAO,CAAA;IAC7B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC5C,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAA;CAC1C;AAED,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,MAAM,CAAC;QACf;;WAEG;QACH,UAAiB,UAAU;YACzB;;eAEG;YACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;YAE1B;;eAEG;YACH,qBAAqB,CAAC,EAAE,MAAM,CAAA;SAC/B;KACF;CACF"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@molecule/api-payments-stripe",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Stripe payment provider for molecule.dev.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"test": "vitest run",
|
|
11
|
+
"test:watch": "vitest"
|
|
12
|
+
},
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"keywords": [
|
|
23
|
+
"molecule",
|
|
24
|
+
"payments",
|
|
25
|
+
"stripe"
|
|
26
|
+
],
|
|
27
|
+
"license": "Apache-2.0",
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"stripe": "22.4.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/node": "26.1.2",
|
|
33
|
+
"typescript": "6.0.3",
|
|
34
|
+
"vitest": "4.1.10"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@molecule/api-bond": "^1.0.0",
|
|
38
|
+
"@molecule/api-i18n": "^1.0.0",
|
|
39
|
+
"@molecule/api-payments": "^1.0.0",
|
|
40
|
+
"@molecule/api-jwt": "^1.0.0",
|
|
41
|
+
"@molecule/api-secrets": "^1.0.0"
|
|
42
|
+
},
|
|
43
|
+
"peerDependenciesMeta": {
|
|
44
|
+
"@molecule/api-payments": {
|
|
45
|
+
"optional": true
|
|
46
|
+
},
|
|
47
|
+
"@molecule/api-jwt": {
|
|
48
|
+
"optional": true
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "https://github.com/molecule-dev/molecule.git",
|
|
54
|
+
"directory": "packages/api/bonds/payments/stripe"
|
|
55
|
+
},
|
|
56
|
+
"homepage": "https://github.com/molecule-dev/molecule/tree/main/packages/api/bonds/payments/stripe",
|
|
57
|
+
"bugs": "https://github.com/molecule-dev/molecule/issues",
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"access": "public"
|
|
60
|
+
}
|
|
61
|
+
}
|