Skip to content

The Open Source DocuSign Alternative.

fix: stripe customer fetch logic

David Nguyen6d7fc32075fd
diff --git a/apps/web/src/app/(dashboard)/settings/billing/create-billing-portal.action.ts b/apps/web/src/app/(dashboard)/settings/billing/create-billing-portal.action.ts
index 98c3d2a96..331943648 100644
--- a/apps/web/src/app/(dashboard)/settings/billing/create-billing-portal.action.ts
+++ b/apps/web/src/app/(dashboard)/settings/billing/create-billing-portal.action.ts
@@ -26,8 +26,10 @@ export const createBillingPortal = async () => {
}
}
- // Fallback to check if a Stripe customer already exists for the current user.
- stripeCustomer = await getStripeCustomerByEmail(user.email);
+ // Fallback to check if a Stripe customer already exists for the current user email.
+ if (!stripeCustomer) {
+ stripeCustomer = await getStripeCustomerByEmail(user.email);
+ }
// Create a Stripe customer if it does not exist for the current user.
if (!stripeCustomer) {