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 stripeCustomerId on checkout-session-completed (#3976)

Pedro Ladeirae4e617d0c4af
diff --git a/apps/web/app/(ee)/api/stripe/integration/webhook/checkout-session-completed.ts b/apps/web/app/(ee)/api/stripe/integration/webhook/checkout-session-completed.ts
index d746573c6c..45a5221409 100644
--- a/apps/web/app/(ee)/api/stripe/integration/webhook/checkout-session-completed.ts
+++ b/apps/web/app/(ee)/api/stripe/integration/webhook/checkout-session-completed.ts
@@ -478,6 +478,10 @@ export async function checkoutSessionCompleted(
},
firstSaleAt: customer.firstSaleAt ? undefined : new Date(),
subscriptionCanceledAt: null,
+ ...(!customer?.stripeCustomerId &&
+ stripeCustomerId && {
+ stripeCustomerId,
+ }),
},
}),
]);