From 59f843f8a01e0f3b448a5facaf37ba79bdb1ebda Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Tue, 10 Feb 2026 17:55:50 -0600 Subject: [PATCH] fix(stripe): filter products to include only monthly and annual subscriptions - Updated the Stripe API response to return only the monthly and annual subscription products. - Enhanced the product listing logic to filter out unnecessary products, improving data handling in the application. --- apps/dokploy/server/api/routers/stripe.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/dokploy/server/api/routers/stripe.ts b/apps/dokploy/server/api/routers/stripe.ts index 412c9e3e8..963ec8c5b 100644 --- a/apps/dokploy/server/api/routers/stripe.ts +++ b/apps/dokploy/server/api/routers/stripe.ts @@ -27,12 +27,17 @@ export const stripeRouter = createTRPCRouter({ const products = await stripe.products.list({ expand: ["data.default_price"], active: true, - ids: [PRODUCT_MONTHLY_ID, PRODUCT_ANNUAL_ID], + }); + + const filteredProducts = products.data.filter((product) => { + return ( + product.id === PRODUCT_MONTHLY_ID || product.id === PRODUCT_ANNUAL_ID + ); }); if (!stripeCustomerId) { return { - products: products.data, + products: filteredProducts, subscriptions: [], }; } @@ -44,7 +49,7 @@ export const stripeRouter = createTRPCRouter({ }); return { - products: products.data, + products: filteredProducts, subscriptions: subscriptions.data, }; }),