@baasix/plugin-stripe 0.1.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.
Files changed (46) hide show
  1. package/README.md +473 -0
  2. package/dist/index.d.ts +52 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +149 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/routes/checkout.d.ts +24 -0
  7. package/dist/routes/checkout.d.ts.map +1 -0
  8. package/dist/routes/checkout.js +58 -0
  9. package/dist/routes/checkout.js.map +1 -0
  10. package/dist/routes/index.d.ts +26 -0
  11. package/dist/routes/index.d.ts.map +1 -0
  12. package/dist/routes/index.js +44 -0
  13. package/dist/routes/index.js.map +1 -0
  14. package/dist/routes/portal.d.ts +31 -0
  15. package/dist/routes/portal.d.ts.map +1 -0
  16. package/dist/routes/portal.js +78 -0
  17. package/dist/routes/portal.js.map +1 -0
  18. package/dist/routes/products.d.ts +26 -0
  19. package/dist/routes/products.d.ts.map +1 -0
  20. package/dist/routes/products.js +65 -0
  21. package/dist/routes/products.js.map +1 -0
  22. package/dist/routes/subscription.d.ts +32 -0
  23. package/dist/routes/subscription.d.ts.map +1 -0
  24. package/dist/routes/subscription.js +121 -0
  25. package/dist/routes/subscription.js.map +1 -0
  26. package/dist/routes/webhook.d.ts +15 -0
  27. package/dist/routes/webhook.d.ts.map +1 -0
  28. package/dist/routes/webhook.js +52 -0
  29. package/dist/routes/webhook.js.map +1 -0
  30. package/dist/schemas/index.d.ts +31 -0
  31. package/dist/schemas/index.d.ts.map +1 -0
  32. package/dist/schemas/index.js +140 -0
  33. package/dist/schemas/index.js.map +1 -0
  34. package/dist/services/stripeService.d.ts +58 -0
  35. package/dist/services/stripeService.d.ts.map +1 -0
  36. package/dist/services/stripeService.js +431 -0
  37. package/dist/services/stripeService.js.map +1 -0
  38. package/dist/types.d.ts +236 -0
  39. package/dist/types.d.ts.map +1 -0
  40. package/dist/types.js +9 -0
  41. package/dist/types.js.map +1 -0
  42. package/dist/utils/loadStripe.d.ts +28 -0
  43. package/dist/utils/loadStripe.d.ts.map +1 -0
  44. package/dist/utils/loadStripe.js +59 -0
  45. package/dist/utils/loadStripe.js.map +1 -0
  46. package/package.json +59 -0
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Checkout Routes
3
+ *
4
+ * Handles one-time payment checkout sessions via Stripe Checkout.
5
+ */
6
+ import type { PluginRoute } from "../types.js";
7
+ /**
8
+ * POST /payments/stripe/checkout
9
+ *
10
+ * Creates a Stripe Checkout session for one-time payment.
11
+ *
12
+ * Request body:
13
+ * - priceId: string - The Stripe price ID to charge
14
+ * - quantity?: number - Quantity of items (default: 1)
15
+ * - successUrl: string - URL to redirect after successful payment
16
+ * - cancelUrl: string - URL to redirect if payment is canceled
17
+ * - metadata?: object - Additional metadata to attach to the session
18
+ *
19
+ * Response:
20
+ * - sessionId: string - The Stripe checkout session ID
21
+ * - url: string - The checkout URL to redirect the user to
22
+ */
23
+ export declare const checkoutRoute: PluginRoute;
24
+ //# sourceMappingURL=checkout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../src/routes/checkout.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAA0B,MAAM,aAAa,CAAC;AAEvE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,EAAE,WAsC3B,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Checkout Routes
3
+ *
4
+ * Handles one-time payment checkout sessions via Stripe Checkout.
5
+ */
6
+ /**
7
+ * POST /payments/stripe/checkout
8
+ *
9
+ * Creates a Stripe Checkout session for one-time payment.
10
+ *
11
+ * Request body:
12
+ * - priceId: string - The Stripe price ID to charge
13
+ * - quantity?: number - Quantity of items (default: 1)
14
+ * - successUrl: string - URL to redirect after successful payment
15
+ * - cancelUrl: string - URL to redirect if payment is canceled
16
+ * - metadata?: object - Additional metadata to attach to the session
17
+ *
18
+ * Response:
19
+ * - sessionId: string - The Stripe checkout session ID
20
+ * - url: string - The checkout URL to redirect the user to
21
+ */
22
+ export const checkoutRoute = {
23
+ path: "/payments/stripe/checkout",
24
+ method: "POST",
25
+ requireAuth: true,
26
+ description: "Create a Stripe checkout session for one-time payment",
27
+ handler: async (req, res, context) => {
28
+ try {
29
+ const { priceId, quantity, successUrl, cancelUrl, metadata } = req.body;
30
+ const userId = req.accountability?.user?.id;
31
+ if (!userId) {
32
+ return res.status(401).json({ error: "Authentication required" });
33
+ }
34
+ if (!priceId || !successUrl || !cancelUrl) {
35
+ return res.status(400).json({
36
+ error: "Missing required fields: priceId, successUrl, cancelUrl",
37
+ });
38
+ }
39
+ const stripeService = context.services.stripeService;
40
+ const result = await stripeService.createCheckoutSession({
41
+ userId,
42
+ priceId,
43
+ quantity,
44
+ successUrl,
45
+ cancelUrl,
46
+ metadata,
47
+ });
48
+ res.json(result);
49
+ }
50
+ catch (error) {
51
+ console.error("[Stripe Plugin] Checkout error:", error);
52
+ res.status(500).json({
53
+ error: error.message || "Failed to create checkout session",
54
+ });
55
+ }
56
+ },
57
+ };
58
+ //# sourceMappingURL=checkout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkout.js","sourceRoot":"","sources":["../../src/routes/checkout.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,aAAa,GAAgB;IACxC,IAAI,EAAE,2BAA2B;IACjC,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,uDAAuD;IACpE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE;QACnC,IAAI,CAAC;YACH,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC;YACxE,MAAM,MAAM,GAAG,GAAG,CAAC,cAAc,EAAE,IAAI,EAAE,EAAE,CAAC;YAE5C,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,yBAAyB,EAAE,CAAC,CAAC;YACpE,CAAC;YAED,IAAI,CAAC,OAAO,IAAI,CAAC,UAAU,IAAI,CAAC,SAAS,EAAE,CAAC;gBAC1C,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;oBAC1B,KAAK,EAAE,yDAAyD;iBACjE,CAAC,CAAC;YACL,CAAC;YAED,MAAM,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,aAAuC,CAAC;YAC/E,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,qBAAqB,CAAC;gBACvD,MAAM;gBACN,OAAO;gBACP,QAAQ;gBACR,UAAU;gBACV,SAAS;gBACT,QAAQ;aACT,CAAC,CAAC;YAEH,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;YACxD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACnB,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,mCAAmC;aAC5D,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Stripe Plugin Routes
3
+ *
4
+ * Exports all route definitions for the Stripe plugin.
5
+ * Routes are organized by functionality:
6
+ * - checkout: One-time payment checkout
7
+ * - subscription: Subscription management
8
+ * - portal: Customer portal and payment history
9
+ * - products: Product listing and sync
10
+ * - webhook: Stripe webhook handler
11
+ */
12
+ import type { PluginRoute, StripePluginConfig } from "../types.js";
13
+ export { checkoutRoute } from "./checkout.js";
14
+ export { subscribeRoute, manageSubscriptionRoute, getUserSubscriptionsRoute, subscriptionRoutes } from "./subscription.js";
15
+ export { portalRoute, getPaymentsRoute, portalRoutes } from "./portal.js";
16
+ export { getProductsRoute, syncProductsRoute, productRoutes } from "./products.js";
17
+ export { createWebhookRoute } from "./webhook.js";
18
+ /**
19
+ * Creates all Stripe plugin routes
20
+ *
21
+ * @param config - Plugin configuration
22
+ * @param getStripe - Function to get Stripe instance
23
+ * @returns Array of all plugin routes
24
+ */
25
+ export declare function createStripeRoutes(config: StripePluginConfig, getStripe: () => Promise<any>): PluginRoute[];
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAQnE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC3H,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,kBAAkB,EAC1B,SAAS,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,GAC5B,WAAW,EAAE,CAaf"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Stripe Plugin Routes
3
+ *
4
+ * Exports all route definitions for the Stripe plugin.
5
+ * Routes are organized by functionality:
6
+ * - checkout: One-time payment checkout
7
+ * - subscription: Subscription management
8
+ * - portal: Customer portal and payment history
9
+ * - products: Product listing and sync
10
+ * - webhook: Stripe webhook handler
11
+ */
12
+ import { checkoutRoute } from "./checkout.js";
13
+ import { subscriptionRoutes } from "./subscription.js";
14
+ import { portalRoutes } from "./portal.js";
15
+ import { productRoutes } from "./products.js";
16
+ import { createWebhookRoute } from "./webhook.js";
17
+ // Re-export individual routes for customization
18
+ export { checkoutRoute } from "./checkout.js";
19
+ export { subscribeRoute, manageSubscriptionRoute, getUserSubscriptionsRoute, subscriptionRoutes } from "./subscription.js";
20
+ export { portalRoute, getPaymentsRoute, portalRoutes } from "./portal.js";
21
+ export { getProductsRoute, syncProductsRoute, productRoutes } from "./products.js";
22
+ export { createWebhookRoute } from "./webhook.js";
23
+ /**
24
+ * Creates all Stripe plugin routes
25
+ *
26
+ * @param config - Plugin configuration
27
+ * @param getStripe - Function to get Stripe instance
28
+ * @returns Array of all plugin routes
29
+ */
30
+ export function createStripeRoutes(config, getStripe) {
31
+ return [
32
+ // Checkout
33
+ checkoutRoute,
34
+ // Subscriptions
35
+ ...subscriptionRoutes,
36
+ // Portal & Payments
37
+ ...portalRoutes,
38
+ // Products
39
+ ...productRoutes,
40
+ // Webhook (needs config and stripe getter)
41
+ createWebhookRoute(config, getStripe),
42
+ ];
43
+ }
44
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,gDAAgD;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC3H,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAA0B,EAC1B,SAA6B;IAE7B,OAAO;QACL,WAAW;QACX,aAAa;QACb,gBAAgB;QAChB,GAAG,kBAAkB;QACrB,oBAAoB;QACpB,GAAG,YAAY;QACf,WAAW;QACX,GAAG,aAAa;QAChB,2CAA2C;QAC3C,kBAAkB,CAAC,MAAM,EAAE,SAAS,CAAC;KACtC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Portal Routes
3
+ *
4
+ * Handles Stripe Customer Portal sessions for self-service billing management.
5
+ */
6
+ import type { PluginRoute } from "../types.js";
7
+ /**
8
+ * POST /payments/stripe/portal
9
+ *
10
+ * Creates a Stripe billing portal session.
11
+ * The portal allows customers to manage their subscriptions,
12
+ * update payment methods, and view invoices.
13
+ *
14
+ * Request body:
15
+ * - returnUrl: string - URL to redirect after leaving the portal
16
+ *
17
+ * Response:
18
+ * - url: string - The portal URL to redirect the user to
19
+ */
20
+ export declare const portalRoute: PluginRoute;
21
+ /**
22
+ * GET /payments/stripe/payments
23
+ *
24
+ * Get the current user's payment history.
25
+ */
26
+ export declare const getPaymentsRoute: PluginRoute;
27
+ /**
28
+ * Portal and payment history routes
29
+ */
30
+ export declare const portalRoutes: PluginRoute[];
31
+ //# sourceMappingURL=portal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../src/routes/portal.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAA0B,MAAM,aAAa,CAAC;AAEvE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,EAAE,WA6BzB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,WAwB9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,WAAW,EAAoC,CAAC"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Portal Routes
3
+ *
4
+ * Handles Stripe Customer Portal sessions for self-service billing management.
5
+ */
6
+ /**
7
+ * POST /payments/stripe/portal
8
+ *
9
+ * Creates a Stripe billing portal session.
10
+ * The portal allows customers to manage their subscriptions,
11
+ * update payment methods, and view invoices.
12
+ *
13
+ * Request body:
14
+ * - returnUrl: string - URL to redirect after leaving the portal
15
+ *
16
+ * Response:
17
+ * - url: string - The portal URL to redirect the user to
18
+ */
19
+ export const portalRoute = {
20
+ path: "/payments/stripe/portal",
21
+ method: "POST",
22
+ requireAuth: true,
23
+ description: "Create a Stripe billing portal session",
24
+ handler: async (req, res, context) => {
25
+ try {
26
+ const { returnUrl } = req.body;
27
+ const userId = req.accountability?.user?.id;
28
+ if (!userId) {
29
+ return res.status(401).json({ error: "Authentication required" });
30
+ }
31
+ if (!returnUrl) {
32
+ return res.status(400).json({ error: "Missing required field: returnUrl" });
33
+ }
34
+ const stripeService = context.services.stripeService;
35
+ const result = await stripeService.createPortalSession(userId, returnUrl);
36
+ res.json(result);
37
+ }
38
+ catch (error) {
39
+ console.error("[Stripe Plugin] Portal error:", error);
40
+ res.status(500).json({
41
+ error: error.message || "Failed to create portal session",
42
+ });
43
+ }
44
+ },
45
+ };
46
+ /**
47
+ * GET /payments/stripe/payments
48
+ *
49
+ * Get the current user's payment history.
50
+ */
51
+ export const getPaymentsRoute = {
52
+ path: "/payments/stripe/payments",
53
+ method: "GET",
54
+ requireAuth: true,
55
+ description: "Get current user's payment history",
56
+ handler: async (req, res, context) => {
57
+ try {
58
+ const userId = req.accountability?.user?.id;
59
+ if (!userId) {
60
+ return res.status(401).json({ error: "Authentication required" });
61
+ }
62
+ const stripeService = context.services.stripeService;
63
+ const payments = await stripeService.getUserPayments(userId);
64
+ res.json(payments);
65
+ }
66
+ catch (error) {
67
+ console.error("[Stripe Plugin] Get payments error:", error);
68
+ res.status(500).json({
69
+ error: error.message || "Failed to get payments",
70
+ });
71
+ }
72
+ },
73
+ };
74
+ /**
75
+ * Portal and payment history routes
76
+ */
77
+ export const portalRoutes = [portalRoute, getPaymentsRoute];
78
+ //# sourceMappingURL=portal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal.js","sourceRoot":"","sources":["../../src/routes/portal.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,WAAW,GAAgB;IACtC,IAAI,EAAE,yBAAyB;IAC/B,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,wCAAwC;IACrD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE;QACnC,IAAI,CAAC;YACH,MAAM,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC;YAC/B,MAAM,MAAM,GAAG,GAAG,CAAC,cAAc,EAAE,IAAI,EAAE,EAAE,CAAC;YAE5C,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,yBAAyB,EAAE,CAAC,CAAC;YACpE,CAAC;YAED,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,mCAAmC,EAAE,CAAC,CAAC;YAC9E,CAAC;YAED,MAAM,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,aAAuC,CAAC;YAC/E,MAA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KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,wBAAwB;aACjD,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAkB,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Product Routes
3
+ *
4
+ * Handles product listing and synchronization from Stripe.
5
+ */
6
+ import type { PluginRoute } from "../types.js";
7
+ /**
8
+ * GET /payments/stripe/products
9
+ *
10
+ * Get all available products and prices.
11
+ * This endpoint is public (no auth required).
12
+ */
13
+ export declare const getProductsRoute: PluginRoute;
14
+ /**
15
+ * POST /payments/stripe/sync-products
16
+ *
17
+ * Sync products and prices from Stripe (admin only).
18
+ * This fetches all active products and prices from Stripe
19
+ * and updates the local database cache.
20
+ */
21
+ export declare const syncProductsRoute: PluginRoute;
22
+ /**
23
+ * Product-related routes
24
+ */
25
+ export declare const productRoutes: PluginRoute[];
26
+ //# sourceMappingURL=products.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../src/routes/products.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAA0B,MAAM,aAAa,CAAC;AAEvE;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,WAkB9B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAwB/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,WAAW,EAA0C,CAAC"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Product Routes
3
+ *
4
+ * Handles product listing and synchronization from Stripe.
5
+ */
6
+ /**
7
+ * GET /payments/stripe/products
8
+ *
9
+ * Get all available products and prices.
10
+ * This endpoint is public (no auth required).
11
+ */
12
+ export const getProductsRoute = {
13
+ path: "/payments/stripe/products",
14
+ method: "GET",
15
+ requireAuth: false,
16
+ description: "Get all available products and prices",
17
+ handler: async (_req, res, context) => {
18
+ try {
19
+ const stripeService = context.services.stripeService;
20
+ const products = await stripeService.getProducts();
21
+ res.json(products);
22
+ }
23
+ catch (error) {
24
+ console.error("[Stripe Plugin] Get products error:", error);
25
+ res.status(500).json({
26
+ error: error.message || "Failed to get products",
27
+ });
28
+ }
29
+ },
30
+ };
31
+ /**
32
+ * POST /payments/stripe/sync-products
33
+ *
34
+ * Sync products and prices from Stripe (admin only).
35
+ * This fetches all active products and prices from Stripe
36
+ * and updates the local database cache.
37
+ */
38
+ export const syncProductsRoute = {
39
+ path: "/payments/stripe/sync-products",
40
+ method: "POST",
41
+ requireAuth: true,
42
+ description: "Sync products and prices from Stripe (admin only)",
43
+ handler: async (req, res, context) => {
44
+ try {
45
+ const isAdmin = req.accountability?.user?.isAdmin;
46
+ if (!isAdmin) {
47
+ return res.status(403).json({ error: "Admin access required" });
48
+ }
49
+ const stripeService = context.services.stripeService;
50
+ await stripeService.syncProducts();
51
+ res.json({ success: true, message: "Products synced successfully" });
52
+ }
53
+ catch (error) {
54
+ console.error("[Stripe Plugin] Sync products error:", error);
55
+ res.status(500).json({
56
+ error: error.message || "Failed to sync products",
57
+ });
58
+ }
59
+ },
60
+ };
61
+ /**
62
+ * Product-related routes
63
+ */
64
+ export const productRoutes = [getProductsRoute, syncProductsRoute];
65
+ //# sourceMappingURL=products.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"products.js","sourceRoot":"","sources":["../../src/routes/products.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAgB;IAC3C,IAAI,EAAE,2BAA2B;IACjC,MAAM,EAAE,KAAK;IACb,WAAW,EAAE,KAAK;IAClB,WAAW,EAAE,uCAAuC;IACpD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE;QACpC,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,O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AAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACnB,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,yBAAyB;aAClD,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAkB,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Subscription Routes
3
+ *
4
+ * Handles subscription checkout and management via Stripe.
5
+ */
6
+ import type { PluginRoute } from "../types.js";
7
+ /**
8
+ * POST /payments/stripe/subscribe
9
+ *
10
+ * Creates a Stripe Checkout session for subscription.
11
+ */
12
+ export declare const subscribeRoute: PluginRoute;
13
+ /**
14
+ * PATCH /payments/stripe/subscription/:id
15
+ *
16
+ * Manage a subscription (cancel or resume).
17
+ *
18
+ * Request body:
19
+ * - action: "cancel" | "resume"
20
+ */
21
+ export declare const manageSubscriptionRoute: PluginRoute;
22
+ /**
23
+ * GET /payments/stripe/subscriptions
24
+ *
25
+ * Get the current user's subscriptions.
26
+ */
27
+ export declare const getUserSubscriptionsRoute: PluginRoute;
28
+ /**
29
+ * All subscription-related routes
30
+ */
31
+ export declare const subscriptionRoutes: PluginRoute[];
32
+ //# sourceMappingURL=subscription.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../src/routes/subscription.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAA0B,MAAM,aAAa,CAAC;AAEvE;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,WAsC5B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,EAAE,WAgCrC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,WAwBvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAAW,EAI3C,CAAC"}
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Subscription Routes
3
+ *
4
+ * Handles subscription checkout and management via Stripe.
5
+ */
6
+ /**
7
+ * POST /payments/stripe/subscribe
8
+ *
9
+ * Creates a Stripe Checkout session for subscription.
10
+ */
11
+ export const subscribeRoute = {
12
+ path: "/payments/stripe/subscribe",
13
+ method: "POST",
14
+ requireAuth: true,
15
+ description: "Create a Stripe checkout session for subscription",
16
+ handler: async (req, res, context) => {
17
+ try {
18
+ const { priceId, successUrl, cancelUrl, trialDays, metadata } = req.body;
19
+ const userId = req.accountability?.user?.id;
20
+ if (!userId) {
21
+ return res.status(401).json({ error: "Authentication required" });
22
+ }
23
+ if (!priceId || !successUrl || !cancelUrl) {
24
+ return res.status(400).json({
25
+ error: "Missing required fields: priceId, successUrl, cancelUrl",
26
+ });
27
+ }
28
+ const stripeService = context.services.stripeService;
29
+ const result = await stripeService.createSubscriptionCheckout({
30
+ userId,
31
+ priceId,
32
+ successUrl,
33
+ cancelUrl,
34
+ trialDays,
35
+ metadata,
36
+ });
37
+ res.json(result);
38
+ }
39
+ catch (error) {
40
+ console.error("[Stripe Plugin] Subscribe error:", error);
41
+ res.status(500).json({
42
+ error: error.message || "Failed to create subscription checkout",
43
+ });
44
+ }
45
+ },
46
+ };
47
+ /**
48
+ * PATCH /payments/stripe/subscription/:id
49
+ *
50
+ * Manage a subscription (cancel or resume).
51
+ *
52
+ * Request body:
53
+ * - action: "cancel" | "resume"
54
+ */
55
+ export const manageSubscriptionRoute = {
56
+ path: "/payments/stripe/subscription/:id",
57
+ method: "PATCH",
58
+ requireAuth: true,
59
+ description: "Cancel or resume a subscription",
60
+ handler: async (req, res, context) => {
61
+ try {
62
+ const { id } = req.params;
63
+ const { action } = req.body;
64
+ const userId = req.accountability?.user?.id;
65
+ if (!userId) {
66
+ return res.status(401).json({ error: "Authentication required" });
67
+ }
68
+ if (!action || !["cancel", "resume"].includes(action)) {
69
+ return res.status(400).json({
70
+ error: "Invalid action. Must be 'cancel' or 'resume'",
71
+ });
72
+ }
73
+ const stripeService = context.services.stripeService;
74
+ const result = await stripeService.manageSubscription(userId, id, action);
75
+ res.json(result);
76
+ }
77
+ catch (error) {
78
+ console.error("[Stripe Plugin] Subscription management error:", error);
79
+ res.status(500).json({
80
+ error: error.message || "Failed to manage subscription",
81
+ });
82
+ }
83
+ },
84
+ };
85
+ /**
86
+ * GET /payments/stripe/subscriptions
87
+ *
88
+ * Get the current user's subscriptions.
89
+ */
90
+ export const getUserSubscriptionsRoute = {
91
+ path: "/payments/stripe/subscriptions",
92
+ method: "GET",
93
+ requireAuth: true,
94
+ description: "Get current user's subscriptions",
95
+ handler: async (req, res, context) => {
96
+ try {
97
+ const userId = req.accountability?.user?.id;
98
+ if (!userId) {
99
+ return res.status(401).json({ error: "Authentication required" });
100
+ }
101
+ const stripeService = context.services.stripeService;
102
+ const subscriptions = await stripeService.getUserSubscriptions(userId);
103
+ res.json(subscriptions);
104
+ }
105
+ catch (error) {
106
+ console.error("[Stripe Plugin] Get subscriptions error:", error);
107
+ res.status(500).json({
108
+ error: error.message || "Failed to get subscriptions",
109
+ });
110
+ }
111
+ },
112
+ };
113
+ /**
114
+ * All subscription-related routes
115
+ */
116
+ export const subscriptionRoutes = [
117
+ subscribeRoute,
118
+ manageSubscriptionRoute,
119
+ getUserSubscriptionsRoute,
120
+ ];
121
+ //# sourceMappingURL=subscription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscription.js","sourceRoot":"","sources":["../../src/routes/subscription.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAgB;IACzC,IAAI,EAAE,4BAA4B;IAClC,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,mDAAmD;IAChE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE;QACnC,IAAI,CAAC;YACH,MAAM,EAAE,OAAO,EAAE,UAAU,EAA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AAE,IAAI;IACjB,WAAW,EAAE,kCAAkC;IAC/C,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE;QACnC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,GAAG,CAAC,cAAc,EAAE,IAAI,EAAE,EAAE,CAAC;YAE5C,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,yBAAyB,EAAE,CAAC,CAAC;YACpE,CAAC;YAED,MAAM,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,aAAuC,CAAC;YAC/E,MAAM,aAAa,GAAG,MAAM,aAAa,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;YAEvE,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC1B,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,0CAA0C,EAAE,KAAK,CAAC,CAAC;YACjE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACnB,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,6BAA6B;aACtD,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAkB;IAC/C,cAAc;IACd,uBAAuB;IACvB,yBAAyB;CAC1B,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Webhook Route
3
+ *
4
+ * Handles incoming Stripe webhook events.
5
+ * This route requires raw body access for signature verification.
6
+ */
7
+ import type { PluginRoute, StripePluginConfig } from "../types.js";
8
+ /**
9
+ * Creates the webhook route with access to config and stripe getter
10
+ *
11
+ * @param config - Plugin configuration (for webhook secret)
12
+ * @param getStripe - Function to get Stripe instance
13
+ */
14
+ export declare function createWebhookRoute(config: StripePluginConfig, getStripe: () => Promise<any>): PluginRoute;
15
+ //# sourceMappingURL=webhook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../src/routes/webhook.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAA0B,MAAM,aAAa,CAAC;AAE3F;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,kBAAkB,EAC1B,SAAS,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,GAC5B,WAAW,CAwCb"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Webhook Route
3
+ *
4
+ * Handles incoming Stripe webhook events.
5
+ * This route requires raw body access for signature verification.
6
+ */
7
+ /**
8
+ * Creates the webhook route with access to config and stripe getter
9
+ *
10
+ * @param config - Plugin configuration (for webhook secret)
11
+ * @param getStripe - Function to get Stripe instance
12
+ */
13
+ export function createWebhookRoute(config, getStripe) {
14
+ return {
15
+ path: "/payments/stripe/webhook",
16
+ method: "POST",
17
+ rawBody: true, // Required for signature verification
18
+ description: "Handle Stripe webhook events",
19
+ handler: async (req, res, context) => {
20
+ const sig = req.headers["stripe-signature"];
21
+ const rawBody = req.rawBody;
22
+ // Validate required headers and body
23
+ if (!sig) {
24
+ return res.status(400).json({ error: "Missing stripe-signature header" });
25
+ }
26
+ if (!rawBody) {
27
+ return res.status(400).json({ error: "Missing raw body" });
28
+ }
29
+ // Verify webhook signature
30
+ let event;
31
+ try {
32
+ const stripeClient = await getStripe();
33
+ event = stripeClient.webhooks.constructEvent(rawBody, sig, config.webhookSecret);
34
+ }
35
+ catch (err) {
36
+ console.error("[Stripe Plugin] Webhook signature verification failed:", err.message);
37
+ return res.status(400).json({ error: "Webhook signature verification failed" });
38
+ }
39
+ // Process the event
40
+ try {
41
+ const stripeService = context.services.stripeService;
42
+ await stripeService.handleWebhook(event);
43
+ res.json({ received: true });
44
+ }
45
+ catch (error) {
46
+ console.error("[Stripe Plugin] Webhook processing error:", error);
47
+ res.status(500).json({ error: "Webhook processing failed" });
48
+ }
49
+ },
50
+ };
51
+ }
52
+ //# sourceMappingURL=webhook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../src/routes/webhook.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAA0B,EAC1B,SAA6B;IAE7B,OAAO;QACL,IAAI,EAAE,0BAA0B;QAChC,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,IAAI,EAAE,sCAAsC;QACrD,WAAW,EAAE,8BAA8B;QAC3C,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE;YACnC,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAW,CAAC;YACtD,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;YAE5B,qCAAqC;YACrC,IAAI,CAAC,GAAG,EAAE,CAAC;gBACT,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,iCAAiC,EAAE,CAAC,CAAC;YAC5E,CAAC;YAED,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC,CAAC;YAC7D,CAAC;YAED,2BAA2B;YAC3B,IAAI,KAAU,CAAC;YACf,IAAI,CAAC;gBACH,MAAM,YAAY,GAAG,MAAM,SAAS,EAAE,CAAC;gBACvC,KAAK,GAAG,YAAY,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC;YACnF,CAAC;YAAC,OAAO,GAAQ,EAAE,CAAC;gBAClB,OAAO,CAAC,KAAK,CAAC,wDAAwD,EAAE,GA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