Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

cus_

Steven Tey9e1181b4c4e9
diff --git a/apps/web/app/api/stripe/connect/webhook/customer-created.ts b/apps/web/app/api/stripe/connect/webhook/customer-created.ts
index 08d83a2f36..331cfcbc82 100644
--- a/apps/web/app/api/stripe/connect/webhook/customer-created.ts
+++ b/apps/web/app/api/stripe/connect/webhook/customer-created.ts
@@ -1,3 +1,4 @@
+import { createId } from "@/lib/api/utils";
import { prisma } from "@/lib/prisma";
import { getClickEvent, recordLead } from "@/lib/tinybird";
import { sendWorkspaceWebhook } from "@/lib/webhook/publish";
@@ -53,6 +54,7 @@ export async function customerCreated(event: Stripe.Event) {
// Create customer
const customer = await prisma.customer.create({
data: {
+ id: createId({ prefix: "cus_" }),
name: stripeCustomer.name,
email: stripeCustomer.email,
stripeCustomerId: stripeCustomer.id,
diff --git a/apps/web/app/api/track/customer/route.ts b/apps/web/app/api/track/customer/route.ts
index 2ba3a86688..4f24d5934d 100644
--- a/apps/web/app/api/track/customer/route.ts
+++ b/apps/web/app/api/track/customer/route.ts
@@ -1,4 +1,4 @@
-import { parseRequestBody } from "@/lib/api/utils";
+import { createId, parseRequestBody } from "@/lib/api/utils";
import { withWorkspaceEdge } from "@/lib/auth/workspace-edge";
import { generateRandomName } from "@/lib/names";
import { prismaEdge } from "@/lib/prisma/edge";
@@ -31,6 +31,7 @@ export const POST = withWorkspaceEdge(
},
},
create: {
+ id: createId({ prefix: "cus_" }),
name: finalCustomerName,
email: customerEmail,
avatar: customerAvatar,
diff --git a/apps/web/app/api/track/lead/route.ts b/apps/web/app/api/track/lead/route.ts
index 918edb467e..1064ece423 100644
--- a/apps/web/app/api/track/lead/route.ts
+++ b/apps/web/app/api/track/lead/route.ts
@@ -1,5 +1,5 @@
import { DubApiError } from "@/lib/api/errors";
-import { parseRequestBody } from "@/lib/api/utils";
+import { createId, parseRequestBody } from "@/lib/api/utils";
import { withWorkspaceEdge } from "@/lib/auth/workspace-edge";
import { generateRandomName } from "@/lib/names";
import { prismaEdge } from "@/lib/prisma/edge";
@@ -71,6 +71,7 @@ export const POST = withWorkspaceEdge(
},
},
create: {
+ id: createId({ prefix: "cus_" }),
name: finalCustomerName,
email: customerEmail,
avatar: customerAvatar,