diff --git a/packages/api/src/controllers/stripe.ts b/packages/api/src/controllers/stripe.ts index 748cd8a713..a9e009153f 100644 --- a/packages/api/src/controllers/stripe.ts +++ b/packages/api/src/controllers/stripe.ts @@ -111,8 +111,8 @@ app.post("/webhook", async (req, res) => { if (payAsYouGoPlans.includes(user.stripeProductId)) { let usage = await getBillingUsage( user.id, - invoice.period_start, - invoice.period_end + 1685311200000, //invoice.period_start, // TMP Fixed billing cycle to test usage + 1687989600000 //invoice.period_end // TMP Fixed billing cycle to test usage ); let overUsage = await calculateOverUsage(user.stripeProductId, usage); diff --git a/packages/api/src/controllers/user.ts b/packages/api/src/controllers/user.ts index 979607ca78..3a9cc84371 100644 --- a/packages/api/src/controllers/user.ts +++ b/packages/api/src/controllers/user.ts @@ -148,6 +148,7 @@ async function getOrCreateSubscription( }); return await stripe.subscriptions.create({ cancel_at_period_end: false, + backdate_start_date: 1685311200, // TEMPORARY BACKDATE TO TEST BILLING customer: stripeCustomerId, items: prices.data.map((item) => ({ price: item.id })), expand: ["latest_invoice.payment_intent"], diff --git a/packages/www/components/UsageSummary/index.tsx b/packages/www/components/UsageSummary/index.tsx index 3df5308843..59791ec89f 100644 --- a/packages/www/components/UsageSummary/index.tsx +++ b/packages/www/components/UsageSummary/index.tsx @@ -101,8 +101,8 @@ const UsageSummary = () => { }; const doGetUsage = async (fromTime, toTime, status) => { - fromTime = fromTime * 1000; - toTime = toTime * 1000; + fromTime = 1685311200000; // fromTime * 1000; // TMP Fixed billing cycle to test usage + toTime = 1687989600000; // toTime * 1000; // TMP Fixed billing cycle to test usage if (status === "canceled") { const now = new Date(); diff --git a/packages/www/pages/dashboard/usage/index.tsx b/packages/www/pages/dashboard/usage/index.tsx index 5d5652c526..55444fa061 100644 --- a/packages/www/pages/dashboard/usage/index.tsx +++ b/packages/www/pages/dashboard/usage/index.tsx @@ -89,8 +89,8 @@ const Usage = () => { toTime: any, status: any ) => { - fromTime = fromTime * 1000; - toTime = toTime * 1000; + fromTime = 1685311200000; // fromTime * 1000; // TMP fixed billing cycle + toTime = 1687989600000; // toTime * 1000; // TMP fixed billing cycle // if subscription is cancelled, get current month data if (status === "canceled") {