Skip to content

Scheduling infrastructure for absolutely everyone.

fix: billing webhook secret (#17005)

Omar López2bdf65ce8cb7
diff --git a/packages/features/ee/billing/api/webhook/__handler.test.ts b/packages/features/ee/billing/api/webhook/__handler.test.ts
index 598db684c54..c2b151f2a67 100644
--- a/packages/features/ee/billing/api/webhook/__handler.test.ts
+++ b/packages/features/ee/billing/api/webhook/__handler.test.ts
@@ -19,11 +19,11 @@ vi.mock("@calcom/app-store/stripepayment/lib/server", () => ({
},
}));
-const STRIPE_WEBHOOK_SECRET = "whsec_test_secret";
+const STRIPE_WEBHOOK_SECRET_BILLING = "whsec_test_secret";
describe("stripeWebhookHandler", () => {
beforeEach(() => {
- vi.stubEnv("STRIPE_WEBHOOK_SECRET", STRIPE_WEBHOOK_SECRET);
+ vi.stubEnv("STRIPE_WEBHOOK_SECRET_BILLING", STRIPE_WEBHOOK_SECRET_BILLING);
});
const mockRequest = (headers: Record<string, string>, body: string): NextApiRequest =>
@@ -41,8 +41,8 @@ describe("stripeWebhookHandler", () => {
await expect(handler(req)).rejects.toThrow(new HttpCode(400, "Missing stripe-signature"));
});
- it("should throw an error if STRIPE_WEBHOOK_SECRET is missing", async () => {
- vi.stubEnv("STRIPE_WEBHOOK_SECRET", "");
+ it("should throw an error if STRIPE_WEBHOOK_SECRET_BILLING is missing", async () => {
+ vi.stubEnv("STRIPE_WEBHOOK_SECRET_BILLING", "");
const { req } = createMocks<CustomNextApiRequest, CustomNextApiResponse>({
method: "POST",
headers: {
diff --git a/packages/features/ee/billing/api/webhook/__handler.ts b/packages/features/ee/billing/api/webhook/__handler.ts
index 97a87185198..b4f21aeb854 100644
--- a/packages/features/ee/billing/api/webhook/__handler.ts
+++ b/packages/features/ee/billing/api/webhook/__handler.ts
@@ -42,7 +42,7 @@ export class HttpCode extends HttpError {
* ```
*/
export const stripeWebhookHandler = (handlers: SWHandlers) => async (req: NextApiRequest) => {
- const STRIPE_WEBHOOK_SECRET = process.env.STRIPE_WEBHOOK_SECRET;
+ const STRIPE_WEBHOOK_SECRET = process.env.STRIPE_WEBHOOK_SECRET_BILLING;
const sig = req.headers["stripe-signature"];
if (!sig) throw new HttpCode(400, "Missing stripe-signature");
if (!STRIPE_WEBHOOK_SECRET) throw new HttpCode(500, "Missing STRIPE_WEBHOOK_SECRET");
diff --git a/turbo.json b/turbo.json
index 430d6f0814d..83feb1792df 100644
--- a/turbo.json
+++ b/turbo.json
@@ -407,6 +407,7 @@
"STRIPE_PRODUCT_ID_STARTER",
"STRIPE_WEBHOOK_SECRET",
"STRIPE_WEBHOOK_SECRET_APPS",
+ "STRIPE_WEBHOOK_SECRET_BILLING",
"TANDEM_BASE_URL",
"TANDEM_CLIENT_ID",
"TANDEM_CLIENT_SECRET",