diff --git a/src/lib/components/billing/paymentModal.svelte b/src/lib/components/billing/paymentModal.svelte index 72accfd101..92aec21a80 100644 --- a/src/lib/components/billing/paymentModal.svelte +++ b/src/lib/components/billing/paymentModal.svelte @@ -42,7 +42,7 @@ const card = await submitStripeCard(name, page?.params?.organization ?? null); if (card && Object.hasOwn(card, 'id')) { - if ((card as PaymentMethod).card.country === 'US') { + if ((card as PaymentMethod).card?.country === 'US') { paymentMethod = card as PaymentMethod; showState = true; return; diff --git a/src/lib/stores/stripe.ts b/src/lib/stores/stripe.ts index 7e5fc31d6b..04c9900812 100644 --- a/src/lib/stores/stripe.ts +++ b/src/lib/stores/stripe.ts @@ -102,7 +102,7 @@ export async function submitStripeCard(name: string, organizationId?: string) { } if (setupIntent && setupIntent.status === 'succeeded') { - if ((setupIntent.payment_method as PaymentMethod).card.country === 'US') { + if ((setupIntent.payment_method as PaymentMethod).card?.country === 'US') { // need to get state return setupIntent.payment_method as PaymentMethod; } diff --git a/src/routes/(console)/organization-[organization]/billing/replaceCard.svelte b/src/routes/(console)/organization-[organization]/billing/replaceCard.svelte index a0b17f7746..a0d5de92da 100644 --- a/src/routes/(console)/organization-[organization]/billing/replaceCard.svelte +++ b/src/routes/(console)/organization-[organization]/billing/replaceCard.svelte @@ -54,7 +54,7 @@ } else { const card = await submitStripeCard(name, organization.$id); if (card && Object.hasOwn(card, 'id')) { - if ((card as PaymentMethod).card.country === 'US') { + if ((card as PaymentMethod).card?.country === 'US') { paymentMethod = card as PaymentMethod; showState = true; return; diff --git a/src/routes/(console)/organization-[organization]/billing/retryPaymentModal.svelte b/src/routes/(console)/organization-[organization]/billing/retryPaymentModal.svelte index 3a9fbfb295..7e39f10ee6 100644 --- a/src/routes/(console)/organization-[organization]/billing/retryPaymentModal.svelte +++ b/src/routes/(console)/organization-[organization]/billing/retryPaymentModal.svelte @@ -66,7 +66,7 @@ } else { const card = await submitStripeCard(name, $organization.$id); if (card && Object.hasOwn(card, 'id')) { - if ((card as PaymentMethod).card.country === 'US') { + if ((card as PaymentMethod).card?.country === 'US') { paymentMethod = card as PaymentMethod; showState = true; return; diff --git a/src/routes/(console)/organization-[organization]/billing/wizard/paymentDetails.svelte b/src/routes/(console)/organization-[organization]/billing/wizard/paymentDetails.svelte index 8e1dd12dab..fd27def7e0 100644 --- a/src/routes/(console)/organization-[organization]/billing/wizard/paymentDetails.svelte +++ b/src/routes/(console)/organization-[organization]/billing/wizard/paymentDetails.svelte @@ -34,7 +34,7 @@ } else { const card = await submitStripeCard(name, $organization.$id); if (card && Object.hasOwn(card, 'id')) { - if ((card as PaymentMethod).card.country === 'US') { + if ((card as PaymentMethod).card?.country === 'US') { paymentMethod = card as PaymentMethod; showState = true; return;