The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update order-paid.ts
Kiran K4890adb1492b
diff --git a/apps/web/app/api/shopify/integration/webhook/order-paid.ts b/apps/web/app/api/shopify/integration/webhook/order-paid.tsindex 83b5906668..7dc5e193bf 100644--- a/apps/web/app/api/shopify/integration/webhook/order-paid.ts+++ b/apps/web/app/api/shopify/integration/webhook/order-paid.ts@@ -37,7 +37,26 @@ export async function orderPaid({return;}- // if no customer is found, wait for the Pixel event to come in so that we can decide if the order is from a Dub link or not+ // Check the cache to see the pixel event for this checkout token exist before publishing the event to the queue+ const clickId = await redis.hget<string>(+ `shopify:checkout:${checkoutToken}`,+ "clickId",+ );++ // clickId is found, process the order for the new customer+ if (clickId) {+ await processOrder({+ event,+ workspaceId,+ clickId,+ });++ await redis.del(`shopify:checkout:${checkoutToken}`);++ return;+ }++ // Wait for the pixel event to come in so that we can decide if the order is from a Dub link or notawait redis.hset(`shopify:checkout:${checkoutToken}`, {order: event,});