diff --git a/apps/dokploy/pages/api/stripe/webhook.ts b/apps/dokploy/pages/api/stripe/webhook.ts index ffbb6736..96e414d9 100644 --- a/apps/dokploy/pages/api/stripe/webhook.ts +++ b/apps/dokploy/pages/api/stripe/webhook.ts @@ -6,11 +6,6 @@ import { asc, eq } from "drizzle-orm"; import type { NextApiRequest, NextApiResponse } from "next"; import Stripe from "stripe"; -const stripe = new Stripe(process.env.STRIPE_SECRET_KEY || "", { - apiVersion: "2024-09-30.acacia", - maxNetworkRetries: 3, -}); - const endpointSecret = process.env.STRIPE_WEBHOOK_SECRET || ""; export const config = { @@ -26,6 +21,11 @@ export default async function handler( if (!endpointSecret) { return res.status(400).send("Webhook Error: Missing Stripe Secret Key"); } + const stripe = new Stripe(process.env.STRIPE_SECRET_KEY || "", { + apiVersion: "2024-09-30.acacia", + maxNetworkRetries: 3, + }); + const buf = await buffer(req); const sig = req.headers["stripe-signature"] as string; diff --git a/apps/dokploy/server/utils/stripe.ts b/apps/dokploy/server/utils/stripe.ts index 26445af7..7044769d 100644 --- a/apps/dokploy/server/utils/stripe.ts +++ b/apps/dokploy/server/utils/stripe.ts @@ -1,14 +1,8 @@ -import Stripe from "stripe"; - export const WEBSITE_URL = process.env.NODE_ENV === "development" ? "http://localhost:3000" : "https://app.dokploy.com"; -export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY || "", { - apiVersion: "2024-09-30.acacia", -}); - const BASE_PRICE_MONTHLY_ID = process.env.BASE_PRICE_MONTHLY_ID || ""; // $4.00 const BASE_ANNUAL_MONTHLY_ID = process.env.BASE_ANNUAL_MONTHLY_ID || ""; // $7.99