diff --git a/frontend/src/components/payments/PricingDialog.tsx b/frontend/src/components/payments/PricingDialog.tsx index 3ad06ad..b1fda04 100644 --- a/frontend/src/components/payments/PricingDialog.tsx +++ b/frontend/src/components/payments/PricingDialog.tsx @@ -10,11 +10,17 @@ import { import { FaCheckCircle } from "react-icons/fa"; import Spinner from "../custom-ui/Spinner"; import useStripeCheckout from "./useStripeCheckout"; +import { Button } from "../ui/button"; const LOGOS = ["microsoft", "amazon", "mit", "stanford", "bytedance", "baidu"]; +const SELL_SUBSCRIPTIONS = false; + const PricingDialog: React.FC = () => { const { checkout, isLoadingCheckout } = useStripeCheckout(); + const [paymentInterval, setPaymentInterval] = React.useState< + "monthly" | "yearly" + >("monthly"); return ( @@ -31,97 +37,173 @@ const PricingDialog: React.FC = () => { + {SELL_SUBSCRIPTIONS && ( +
+ + +
+ )} +
- {/* Free Plan */} -
-

Hobby

-

Great to start

-
- $15 - {/* / month */} -
- - - -
    -
  • - - 100 credits -
  • -
  • - - Email support -
  • -
-
+ {!SELL_SUBSCRIPTIONS && ( + <> +
+

Hobby

+

Great to start

+
+ $15 +
+ + + +
    +
  • + + 100 credits +
  • +
  • + + Email support +
  • +
+
- {/* Economy Plan */} -
-

Pro

-

Higher limits

-
- $40 - {/* / month */} -
+
+

Pro

+

Higher limits

+
+ $40 + {/* / month */} +
- - - + + + -
    -
  • - - 300 credits -
  • -
  • - - Slack support -
  • -
-
+
    +
  • + + 300 credits +
  • +
  • + + Slack support +
  • +
+
+ + )} - {/* Economy Plan */} -
-

Hobby

-

Higher limits

-
- $15 - / month -
+ {SELL_SUBSCRIPTIONS && ( + <> +
+

Hobby

+

Great to start

+
+ + {paymentInterval === "monthly" ? "$15" : "$150"} + + + {paymentInterval === "monthly" ? "/ month" : "/ year"} + +
- + -
    -
  • - - 300 credits -
  • -
  • - - Slack support -
  • -
-
+
    +
  • + + 100 credits / mo +
  • +
  • + + Email support +
  • +
+
+ +
+

Pro

+

Higher limits

+
+ + {paymentInterval === "monthly" ? "$40" : "$400"} + + + {paymentInterval === "monthly" ? "/ month" : "/ year"} + +
+ + + +
    +
  • + + 300 credits / mo +
  • +
  • + + Slack support +
  • +
+
+ + )}

1 credit = 1 code generation. Unused credits expire after 90 days. + {SELL_SUBSCRIPTIONS && ( + <> +
+ Cancel anytime. + + )}

diff --git a/frontend/src/components/payments/useStripeCheckout.ts b/frontend/src/components/payments/useStripeCheckout.ts index 23e266c..52b72eb 100644 --- a/frontend/src/components/payments/useStripeCheckout.ts +++ b/frontend/src/components/payments/useStripeCheckout.ts @@ -28,7 +28,7 @@ export default function useStripeCheckout() { // Create a Checkout Session const res: CreateCheckoutSessionResponse = await authenticatedFetch( - `${SAAS_BACKEND_URL}/create_checkout_session` + + `${SAAS_BACKEND_URL}/payments/create_checkout_session` + `?price_lookup_key=${priceLookupKey}` + `&rewardful_referral_id=${rewardfulReferralId}`, "POST"