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.

Update route.ts

Steven Tey1b6260b5fb4c
diff --git a/apps/web/app/api/campaigns/webhooks/stripe/route.ts b/apps/web/app/api/campaigns/webhooks/stripe/route.ts
index 5f5fd8d8a3..9fc0f7d7f8 100644
--- a/apps/web/app/api/campaigns/webhooks/stripe/route.ts
+++ b/apps/web/app/api/campaigns/webhooks/stripe/route.ts
@@ -1,5 +1,6 @@
import { stripe } from "@/lib/stripe";
import { getClickEvent, recordConversion } from "@/lib/tinybird";
+import { nanoid } from "@dub/utils";
import type Stripe from "stripe";
const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET;
@@ -79,9 +80,10 @@ async function handleChargeSucceeded(event: Stripe.Event) {
await recordConversion({
...clickEvent.data[0],
- event_name: "",
+ event_id: nanoid(16),
+ event_name: "Subscribed to plan",
event_type: "sale",
- event_metadata: "",
+ metadata: "",
customer_id: customerId,
timestamp: new Date(Date.now()).toISOString(),
});