The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Use Dub workspace stripeId for Acme domain renewals (#4056)
Kiran Kb6e4d87c119b
diff --git a/apps/web/app/(ee)/api/cron/domains/renewal-payments/route.ts b/apps/web/app/(ee)/api/cron/domains/renewal-payments/route.tsindex 886b1a2566..43d91715f2 100644--- a/apps/web/app/(ee)/api/cron/domains/renewal-payments/route.ts+++ b/apps/web/app/(ee)/api/cron/domains/renewal-payments/route.ts@@ -4,7 +4,7 @@ import { verifyVercelSignature } from "@/lib/cron/verify-vercel";import { createPaymentIntent } from "@/lib/stripe/create-payment-intent";import { prisma } from "@dub/prisma";import { Invoice, Project, RegisteredDomain } from "@dub/prisma/client";-import { log } from "@dub/utils";+import { ACME_WORKSPACE_ID, DUB_WORKSPACE_ID, log } from "@dub/utils";import { addDays, endOfDay, startOfDay } from "date-fns";import { NextResponse } from "next/server";@@ -129,7 +129,28 @@ export async function GET(req: Request) {// Create payment intent for each invoicefor (const invoice of invoices) {- const { workspace } = groupedByWorkspace[invoice.workspaceId];+ let { workspace } = groupedByWorkspace[invoice.workspaceId];++ // If Acme workspace, use Dub workspace stripeId+ if (workspace.id === ACME_WORKSPACE_ID) {+ const dubWorkspace = await prisma.project.findUniqueOrThrow({+ where: {+ id: DUB_WORKSPACE_ID,+ },+ select: {+ stripeId: true,+ },+ });++ workspace = {+ ...workspace,+ stripeId: dubWorkspace.stripeId,+ };++ console.log(+ `Using Dub workspace stripeId for Acme workspace domains...`,+ );+ }if (!workspace.stripeId) {console.log(`Workspace ${workspace.id} has no stripeId, skipping...`);@@ -137,7 +158,7 @@ export async function GET(req: Request) {}const res = await createPaymentIntent({- stripeId: workspace.stripeId!,+ stripeId: workspace.stripeId,amount: invoice.total,invoiceId: invoice.id,statementDescriptor: "DUB.CO DOMAIN RENEWAL",