From 743a6d0f67a58da1e51d22198f1433fe24e84c87 Mon Sep 17 00:00:00 2001 From: "prompt.ac/@jeffrey" Date: Wed, 22 Jul 2026 13:41:57 -0700 Subject: [PATCH] Fix Stripe client construction --- system/netlify/functions/email.js | 2 +- system/netlify/functions/sotce-net.mjs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/system/netlify/functions/email.js b/system/netlify/functions/email.js index 67c79ba4ab..6210f2a1aa 100644 --- a/system/netlify/functions/email.js +++ b/system/netlify/functions/email.js @@ -100,7 +100,7 @@ export async function handler(event, context) { ? SOTCE_STRIPE_API_TEST_PRIV_KEY : SOTCE_STRIPE_API_PRIV_KEY; - const stripe = Stripe(key); + const stripe = new Stripe(key); // Fetch customer by user ID (sub) from metadata const customers = await stripe.customers.search({ diff --git a/system/netlify/functions/sotce-net.mjs b/system/netlify/functions/sotce-net.mjs index 9eeaf6a738..b4464f19fa 100644 --- a/system/netlify/functions/sotce-net.mjs +++ b/system/netlify/functions/sotce-net.mjs @@ -177,7 +177,7 @@ export const handler = async (event, context) => { shell.log("🔍 Checking Stripe for subscription..."); // 🩷 Then query it from Stripe, - const stripe = Stripe(key); + const stripe = new Stripe(key); // Fetch customer by user ID (sub) from subscription metadata field. const customers = await stripe.customers.search({ query: "metadata['sub']:'" + user.sub + "'", @@ -231,7 +231,7 @@ export const handler = async (event, context) => { // TODO: Put this behind a redis cache... 24.10.14.01.23 async function getActiveSubscriptionCount(productId) { try { - const stripe = Stripe(key); + const stripe = new Stripe(key); // Fetch all subscriptions with the active status let hasMore = true; @@ -270,7 +270,7 @@ export const handler = async (event, context) => { // TODO: Put this behind a redis cache... 24.10.14.01.23 async function getCumulativeSubscriptionCount(productId) { try { - const stripe = Stripe(key); + const stripe = new Stripe(key); // Fetch all subscriptions regardless of status. let hasMore = true; @@ -10182,7 +10182,7 @@ export const handler = async (event, context) => { } } else if (path === "/subscribe" && method === "post") { try { - const stripe = Stripe(key); + const stripe = new Stripe(key); const redirectPath = event.headers.origin === "https://sotce.net" ? "" : "sotce-net"; @@ -11061,7 +11061,7 @@ async function cancelSubscription(user, key) { const email = user.email; const result = { status: undefined, body: undefined }; try { - const stripe = Stripe(key); + const stripe = new Stripe(key); // Fetch customer by email const customers = await stripe.customers.list({ email, limit: 1 }); if (customers.data.length === 0) { -- 2.51.2