- You are using free plan,
+ You are not subscribed to any plan,
)}
- {billingDetails?.status !== 'none' && !isLoadingBillingDetails && (
- <>
- {billingDetails?.status === 'past_due' && (
-
- We were not able to charge your card. Please update your payment
- information.
-
- )}
-
-
-
- Plan
-
- {selectedPlanDetails?.name}
-
-
-
+ {billingDetails?.status !== 'none' &&
+ !isLoadingBillingDetails &&
+ priceDetails && (
+ <>
+ {billingDetails?.status === 'past_due' && (
+
+ We were not able to charge your card. Please update your payment
+ information.
+
+ )}
+
+
- Payment
+ Plan
- ${priceDetails!.amount / 100}
-
- / {priceDetails!.interval}
-
+ {selectedPlanDetails?.name}
-
- {!shouldHideDeleteButton && (
-
- )}
+
+
+ Payment
+
+ ${priceDetails.amount}
+
+ / {priceDetails.interval}
+
+
+
+
+ {!shouldHideDeleteButton && (
+
+ )}
+
-
-
-
-
-
- {billingDetails?.cancelAtPeriodEnd ? 'Expires On' : 'Renews On'}
-
-
- {formattedNextBillDate}
-
+
+
+
+
+ {billingDetails?.cancelAtPeriodEnd
+ ? 'Expires On'
+ : 'Renews On'}
+
+
+ {formattedNextBillDate}
+
+
+
-
-
- >
- )}
+ >
+ )}
>
);
}
diff --git a/src/components/Billing/UpgradeAccountModal.tsx b/src/components/Billing/UpgradeAccountModal.tsx
index 274bc7ab6..18a57e0e3 100644
--- a/src/components/Billing/UpgradeAccountModal.tsx
+++ b/src/components/Billing/UpgradeAccountModal.tsx
@@ -26,10 +26,13 @@ type CreateSubscriptionCheckoutSessionResponse = {
type UpgradeAccountModalProps = {
onClose: () => void;
+
+ success?: string;
+ cancel?: string;
};
export function UpgradeAccountModal(props: UpgradeAccountModalProps) {
- const { onClose } = props;
+ const { onClose, success, cancel } = props;
const [selectedPlan, setSelectedPlan] =
useState
('month');
@@ -199,8 +202,8 @@ export function UpgradeAccountModal(props: UpgradeAccountModalProps) {
const currentUrlPath = window.location.pathname;
createCheckoutSession({
priceId: plan.priceId,
- success: `${currentUrlPath}?s=1`,
- cancel: `${currentUrlPath}?s=0`,
+ success: success || `${currentUrlPath}?s=1`,
+ cancel: cancel || `${currentUrlPath}?s=0`,
});
return;
}