@mostajs/subscriptions-plan 0.1.0 → 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.
|
@@ -2,6 +2,7 @@ import type Stripe from 'stripe';
|
|
|
2
2
|
import type { BillingConfig } from '../types/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Create a Stripe Checkout session for subscription billing.
|
|
5
|
+
* Delegates to @mostajs/payment.createBillingSession
|
|
5
6
|
*/
|
|
6
7
|
export declare function createBillingSession(stripe: Stripe, config: BillingConfig, params: {
|
|
7
8
|
customerId: string;
|
|
@@ -15,11 +16,17 @@ export declare function createBillingSession(stripe: Stripe, config: BillingConf
|
|
|
15
16
|
sessionId: string;
|
|
16
17
|
}>;
|
|
17
18
|
/**
|
|
18
|
-
* Create a Stripe Customer Portal session
|
|
19
|
+
* Create a Stripe Customer Portal session.
|
|
20
|
+
* Delegates to @mostajs/payment.createPortalSession
|
|
19
21
|
*/
|
|
20
22
|
export declare function createPortalSession(stripe: Stripe, config: BillingConfig, customerId: string): Promise<{
|
|
21
23
|
url: string;
|
|
22
24
|
}>;
|
|
25
|
+
/**
|
|
26
|
+
* Verify a Stripe webhook event.
|
|
27
|
+
* Delegates to @mostajs/payment.handleWebhook
|
|
28
|
+
*/
|
|
29
|
+
export declare function verifyWebhookEvent(stripe: Stripe, body: string | Buffer, signature: string, secret: string): Promise<Stripe.Event>;
|
|
23
30
|
/**
|
|
24
31
|
* Create a Stripe customer for a new account.
|
|
25
32
|
*/
|
|
@@ -29,7 +36,7 @@ export declare function createStripeCustomer(stripe: Stripe, params: {
|
|
|
29
36
|
metadata?: Record<string, string>;
|
|
30
37
|
}): Promise<string>;
|
|
31
38
|
/**
|
|
32
|
-
* Cancel a Stripe subscription
|
|
39
|
+
* Cancel a Stripe subscription.
|
|
33
40
|
*/
|
|
34
41
|
export declare function cancelSubscription(stripe: Stripe, stripeSubId: string, immediate?: boolean): Promise<void>;
|
|
35
42
|
/**
|
|
@@ -37,12 +44,7 @@ export declare function cancelSubscription(stripe: Stripe, stripeSubId: string,
|
|
|
37
44
|
*/
|
|
38
45
|
export declare function changeSubscriptionPlan(stripe: Stripe, stripeSubId: string, newPriceId: string): Promise<void>;
|
|
39
46
|
/**
|
|
40
|
-
*
|
|
41
|
-
*/
|
|
42
|
-
export declare function verifyWebhookEvent(stripe: Stripe, body: string | Buffer, signature: string, secret: string): Stripe.Event;
|
|
43
|
-
/**
|
|
44
|
-
* Handle billing webhook events.
|
|
45
|
-
* Returns the action taken for logging/auditing.
|
|
47
|
+
* Parse billing webhook events into structured actions.
|
|
46
48
|
*/
|
|
47
49
|
export declare function parseBillingEvent(event: Stripe.Event): {
|
|
48
50
|
type: 'subscription_created' | 'subscription_updated' | 'subscription_deleted' | 'invoice_paid' | 'invoice_failed' | 'checkout_completed' | 'unknown';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stripe-billing.d.ts","sourceRoot":"","sources":["../../src/lib/stripe-billing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stripe-billing.d.ts","sourceRoot":"","sources":["../../src/lib/stripe-billing.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAItD;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE;IACN,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAClC,GACA,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;I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|
|
|
1
1
|
// @mostajs/subscriptions-plan — Stripe Billing integration
|
|
2
2
|
// Author: Dr Hamid MADANI drmdh@msn.com
|
|
3
|
+
// v0.2.0: delegates to @mostajs/payment for core Stripe operations
|
|
4
|
+
// ─── Delegate to @mostajs/payment ───────────────────────────
|
|
3
5
|
/**
|
|
4
6
|
* Create a Stripe Checkout session for subscription billing.
|
|
7
|
+
* Delegates to @mostajs/payment.createBillingSession
|
|
5
8
|
*/
|
|
6
9
|
export async function createBillingSession(stripe, config, params) {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
trial_period_days: params.trialDays,
|
|
15
|
-
metadata: params.metadata,
|
|
16
|
-
},
|
|
10
|
+
const { createBillingSession: pmBilling } = await import('@mostajs/payment/server');
|
|
11
|
+
return pmBilling(stripe, {
|
|
12
|
+
customerId: params.customerId,
|
|
13
|
+
priceId: params.priceId,
|
|
14
|
+
successUrl: params.successUrl ?? config.successUrl,
|
|
15
|
+
cancelUrl: params.cancelUrl ?? config.cancelUrl,
|
|
16
|
+
trialDays: params.trialDays,
|
|
17
17
|
metadata: params.metadata,
|
|
18
18
|
});
|
|
19
|
-
return { url: session.url, sessionId: session.id };
|
|
20
19
|
}
|
|
21
20
|
/**
|
|
22
|
-
* Create a Stripe Customer Portal session
|
|
21
|
+
* Create a Stripe Customer Portal session.
|
|
22
|
+
* Delegates to @mostajs/payment.createPortalSession
|
|
23
23
|
*/
|
|
24
24
|
export async function createPortalSession(stripe, config, customerId) {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
return_url: config.portalReturnUrl,
|
|
28
|
-
});
|
|
29
|
-
return { url: session.url };
|
|
25
|
+
const { createPortalSession: pmPortal } = await import('@mostajs/payment/server');
|
|
26
|
+
return pmPortal(stripe, customerId, config.portalReturnUrl);
|
|
30
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Verify a Stripe webhook event.
|
|
30
|
+
* Delegates to @mostajs/payment.handleWebhook
|
|
31
|
+
*/
|
|
32
|
+
export async function verifyWebhookEvent(stripe, body, signature, secret) {
|
|
33
|
+
const { handleWebhook } = await import('@mostajs/payment/server');
|
|
34
|
+
return handleWebhook(stripe, body, signature, secret);
|
|
35
|
+
}
|
|
36
|
+
// ─── Subscriptions-plan specific ────────────────────────────
|
|
31
37
|
/**
|
|
32
38
|
* Create a Stripe customer for a new account.
|
|
33
39
|
*/
|
|
@@ -40,16 +46,14 @@ export async function createStripeCustomer(stripe, params) {
|
|
|
40
46
|
return customer.id;
|
|
41
47
|
}
|
|
42
48
|
/**
|
|
43
|
-
* Cancel a Stripe subscription
|
|
49
|
+
* Cancel a Stripe subscription.
|
|
44
50
|
*/
|
|
45
51
|
export async function cancelSubscription(stripe, stripeSubId, immediate = false) {
|
|
46
52
|
if (immediate) {
|
|
47
53
|
await stripe.subscriptions.cancel(stripeSubId);
|
|
48
54
|
}
|
|
49
55
|
else {
|
|
50
|
-
await stripe.subscriptions.update(stripeSubId, {
|
|
51
|
-
cancel_at_period_end: true,
|
|
52
|
-
});
|
|
56
|
+
await stripe.subscriptions.update(stripeSubId, { cancel_at_period_end: true });
|
|
53
57
|
}
|
|
54
58
|
}
|
|
55
59
|
/**
|
|
@@ -58,35 +62,18 @@ export async function cancelSubscription(stripe, stripeSubId, immediate = false)
|
|
|
58
62
|
export async function changeSubscriptionPlan(stripe, stripeSubId, newPriceId) {
|
|
59
63
|
const sub = await stripe.subscriptions.retrieve(stripeSubId);
|
|
60
64
|
await stripe.subscriptions.update(stripeSubId, {
|
|
61
|
-
items: [{
|
|
62
|
-
id: sub.items.data[0].id,
|
|
63
|
-
price: newPriceId,
|
|
64
|
-
}],
|
|
65
|
+
items: [{ id: sub.items.data[0].id, price: newPriceId }],
|
|
65
66
|
proration_behavior: 'always_invoice',
|
|
66
67
|
});
|
|
67
68
|
}
|
|
68
69
|
/**
|
|
69
|
-
*
|
|
70
|
-
*/
|
|
71
|
-
export function verifyWebhookEvent(stripe, body, signature, secret) {
|
|
72
|
-
return stripe.webhooks.constructEvent(body, signature, secret);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Handle billing webhook events.
|
|
76
|
-
* Returns the action taken for logging/auditing.
|
|
70
|
+
* Parse billing webhook events into structured actions.
|
|
77
71
|
*/
|
|
78
72
|
export function parseBillingEvent(event) {
|
|
79
73
|
switch (event.type) {
|
|
80
74
|
case 'checkout.session.completed': {
|
|
81
|
-
const
|
|
82
|
-
return {
|
|
83
|
-
type: 'checkout_completed',
|
|
84
|
-
data: {
|
|
85
|
-
customerId: session.customer,
|
|
86
|
-
subscriptionId: session.subscription,
|
|
87
|
-
metadata: session.metadata,
|
|
88
|
-
},
|
|
89
|
-
};
|
|
75
|
+
const s = event.data.object;
|
|
76
|
+
return { type: 'checkout_completed', data: { customerId: s.customer, subscriptionId: s.subscription, metadata: s.metadata } };
|
|
90
77
|
}
|
|
91
78
|
case 'customer.subscription.created':
|
|
92
79
|
case 'customer.subscription.updated': {
|
|
@@ -94,9 +81,7 @@ export function parseBillingEvent(event) {
|
|
|
94
81
|
return {
|
|
95
82
|
type: event.type === 'customer.subscription.created' ? 'subscription_created' : 'subscription_updated',
|
|
96
83
|
data: {
|
|
97
|
-
stripeSubId: sub.id,
|
|
98
|
-
customerId: sub.customer,
|
|
99
|
-
status: sub.status,
|
|
84
|
+
stripeSubId: sub.id, customerId: sub.customer, status: sub.status,
|
|
100
85
|
priceId: sub.items.data[0]?.price?.id,
|
|
101
86
|
currentPeriodStart: new Date(sub.current_period_start * 1000).toISOString(),
|
|
102
87
|
currentPeriodEnd: new Date(sub.current_period_end * 1000).toISOString(),
|
|
@@ -106,42 +91,21 @@ export function parseBillingEvent(event) {
|
|
|
106
91
|
}
|
|
107
92
|
case 'customer.subscription.deleted': {
|
|
108
93
|
const sub = event.data.object;
|
|
109
|
-
return {
|
|
110
|
-
type: 'subscription_deleted',
|
|
111
|
-
data: {
|
|
112
|
-
stripeSubId: sub.id,
|
|
113
|
-
customerId: sub.customer,
|
|
114
|
-
},
|
|
115
|
-
};
|
|
94
|
+
return { type: 'subscription_deleted', data: { stripeSubId: sub.id, customerId: sub.customer } };
|
|
116
95
|
}
|
|
117
96
|
case 'invoice.paid': {
|
|
118
|
-
const
|
|
97
|
+
const inv = event.data.object;
|
|
119
98
|
return {
|
|
120
99
|
type: 'invoice_paid',
|
|
121
100
|
data: {
|
|
122
|
-
stripeInvoiceId:
|
|
123
|
-
|
|
124
|
-
subscriptionId: invoice.subscription,
|
|
125
|
-
amount: invoice.amount_paid,
|
|
126
|
-
currency: invoice.currency,
|
|
127
|
-
pdfUrl: invoice.invoice_pdf,
|
|
128
|
-
hostedUrl: invoice.hosted_invoice_url,
|
|
129
|
-
periodStart: invoice.period_start ? new Date(invoice.period_start * 1000).toISOString() : null,
|
|
130
|
-
periodEnd: invoice.period_end ? new Date(invoice.period_end * 1000).toISOString() : null,
|
|
101
|
+
stripeInvoiceId: inv.id, customerId: inv.customer, subscriptionId: inv.subscription,
|
|
102
|
+
amount: inv.amount_paid, currency: inv.currency, pdfUrl: inv.invoice_pdf,
|
|
131
103
|
},
|
|
132
104
|
};
|
|
133
105
|
}
|
|
134
106
|
case 'invoice.payment_failed': {
|
|
135
|
-
const
|
|
136
|
-
return {
|
|
137
|
-
type: 'invoice_failed',
|
|
138
|
-
data: {
|
|
139
|
-
stripeInvoiceId: invoice.id,
|
|
140
|
-
customerId: invoice.customer,
|
|
141
|
-
subscriptionId: invoice.subscription,
|
|
142
|
-
amount: invoice.amount_due,
|
|
143
|
-
},
|
|
144
|
-
};
|
|
107
|
+
const inv = event.data.object;
|
|
108
|
+
return { type: 'invoice_failed', data: { stripeInvoiceId: inv.id, customerId: inv.customer, amount: inv.amount_due } };
|
|
145
109
|
}
|
|
146
110
|
default:
|
|
147
111
|
return { type: 'unknown', data: { eventType: event.type } };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stripe-billing.js","sourceRoot":"","sources":["../../src/lib/stripe-billing.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,wCAAwC;
|
|
1
|
+
{"version":3,"file":"stripe-billing.js","sourceRoot":"","sources":["../../src/lib/stripe-billing.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,wCAAwC;AACxC,mEAAmE;AAKnE,+DAA+D;AAE/D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAAc,EACd,MAAqB,EACrB,MAOC;IAED,MAAM,EAAE,oBAAoB,EAAE,SAAS,EAAE,GAAG,MAAM,MAAM,CAAC,yBAAyB,CAAC,CAAA;IACnF,OAAO,SAAS,CAAC,MAAM,EAAE;QACvB,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU;QAClD,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,SAAS;QAC/C,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;KAC1B,CAAC,CAAA;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,MAAc,EACd,MAAqB,EACrB,UAAkB;IAElB,MAAM,EAAE,mBAAmB,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,yBAAyB,CAAC,CAAA;IACjF,OAAO,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,eAAe,CAAC,CAAA;AAC7D,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAAc,EACd,IAAqB,EACrB,SAAiB,EACjB,MAAc;IAEd,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,yBAAyB,CAAC,CAAA;IACjE,OAAO,aAAa,CAAC,MAAM,EAAE,IAAI,EAAE,S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AAC,MAA6B,CAAA;YACpD,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,GAAG,CAAC,EAAE,EAAE,UAAU,EAAE,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAA;QAClG,CAAC;QACD,KAAK,cAAc,CAAC,CAAC,CAAC;YACpB,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,MAAwB,CAAA;YAC/C,OAAO;gBACL,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE;oBACJ,eAAe,EAAE,GAAG,CAAC,EAAE,EAAE,UAAU,EAAE,GAAG,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,CAAC,YAAY;oBACnF,MAAM,EAAE,GAAG,CAAC,WAAW,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,WAAW;iBACzE;aACF,CAAA;QACH,CAAC;QACD,KAAK,wBAAwB,CAAC,CAAC,CAAC;YAC9B,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,MAAwB,CAAA;YAC/C,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,EAAE,eAAe,EAAE,GAAG,CAAC,EAAE,EAAE,UAAU,EAAE,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,EAAE,CAAA;QACxH,CAAC;QACD;YACE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,CAAA;IAC/D,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mostajs/subscriptions-plan",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Subscription plans, billing, invoices and usage tracking for @mostajs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,15 +29,30 @@
|
|
|
29
29
|
],
|
|
30
30
|
"author": "Dr Hamid MADANI <drmdh@msn.com>",
|
|
31
31
|
"license": "MIT",
|
|
32
|
-
"dependencies": {
|
|
33
|
-
"stripe": "^17.0.0"
|
|
34
|
-
},
|
|
35
32
|
"peerDependencies": {
|
|
36
33
|
"@mostajs/orm": "^1.8.0",
|
|
34
|
+
"@mostajs/payment": ">=0.2.0",
|
|
37
35
|
"next": ">=14.0.0",
|
|
38
|
-
"react": ">=18.0.0"
|
|
36
|
+
"react": ">=18.0.0",
|
|
37
|
+
"stripe": ">=17.0.0"
|
|
38
|
+
},
|
|
39
|
+
"peerDependenciesMeta": {
|
|
40
|
+
"@mostajs/payment": {
|
|
41
|
+
"optional": true
|
|
42
|
+
},
|
|
43
|
+
"stripe": {
|
|
44
|
+
"optional": true
|
|
45
|
+
},
|
|
46
|
+
"next": {
|
|
47
|
+
"optional": true
|
|
48
|
+
},
|
|
49
|
+
"react": {
|
|
50
|
+
"optional": true
|
|
51
|
+
}
|
|
39
52
|
},
|
|
40
53
|
"devDependencies": {
|
|
54
|
+
"@mostajs/orm": "file:../mosta-orm",
|
|
55
|
+
"@mostajs/payment": "file:../mosta-payment",
|
|
41
56
|
"@types/node": "^22.0.0",
|
|
42
57
|
"better-sqlite3": "^12.0.0",
|
|
43
58
|
"tsx": "^4.0.0",
|