🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Enhance subscription checkout process with Stripe integration (#910)
Goldflag79b3af0e772d
diff --git a/client/Dockerfile b/client/Dockerfileindex 5d6194459..f67932579 100644--- a/client/Dockerfile+++ b/client/Dockerfile@@ -29,10 +29,12 @@ ARG NEXT_PUBLIC_BACKEND_URLARG NEXT_PUBLIC_DISABLE_SIGNUPARG NEXT_PUBLIC_CLOUDARG NEXT_PUBLIC_TURNSTILE_SITE_KEY+ARG NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEYENV NEXT_PUBLIC_BACKEND_URL=${NEXT_PUBLIC_BACKEND_URL}ENV NEXT_PUBLIC_DISABLE_SIGNUP=${NEXT_PUBLIC_DISABLE_SIGNUP}ENV NEXT_PUBLIC_CLOUD=${NEXT_PUBLIC_CLOUD}ENV NEXT_PUBLIC_TURNSTILE_SITE_KEY=${NEXT_PUBLIC_TURNSTILE_SITE_KEY}+ENV NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=${NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY}WORKDIR /app/clientRUN npm run builddiff --git a/client/messages/cs.json b/client/messages/cs.jsonindex b0790f056..68c52998a 100644--- a/client/messages/cs.json+++ b/client/messages/cs.json@@ -868,7 +868,7 @@"cdVnd3": "Pro předplatné prosím vyber organizaci.","Po5b4M": "Vybraný cenový plán nebyl nalezen. Uprav prosím posuvník.","NLmfEq": "Nepodařilo se vytvořit platební relaci.",- "lMJ3zA": "URL pro platbu nebylo přijato.",+ "Xtxl5C": "","+bk3BW": "Předplatné selhalo: {message}","9h0k8z": "Měsíční zobrazení stránek","wYsv4Z": "Měsíční",@@ -883,7 +883,7 @@"fr4eNi": "Testovací předplatné za $1 pro vývoj","CnmIg8": "Předplatit ($1)","5dX7fM": "Pokročilé funkce pro firemní týmy",- "5Wwopw": "Ceník",+ "GnHuiT": "","vYmJVk": "","UHF9uv": "Tvé zkušební využití","blVqkQ": "Aktuální využití",diff --git a/client/messages/de.json b/client/messages/de.jsonindex cc31ae100..b094c174a 100644--- a/client/messages/de.json+++ b/client/messages/de.json@@ -868,7 +868,7 @@"cdVnd3": "Bitte wählen Sie eine Organisation zum Abonnieren aus.","Po5b4M": "Ausgewählter Preisplan nicht gefunden. Bitte passen Sie den Schieberegler an.","NLmfEq": "Checkout-Sitzung konnte nicht erstellt werden.",- "lMJ3zA": "Keine Checkout-URL erhalten.",+ "Xtxl5C": "","+bk3BW": "Abonnement fehlgeschlagen: {message}","9h0k8z": "Monatliche Seitenaufrufe","wYsv4Z": "Monatlich",@@ -883,8 +883,8 @@"fr4eNi": "1 $ Test-Abonnement für Entwicklung","CnmIg8": "Abonnieren (1 $)","5dX7fM": "Erweiterte Funktionen für Unternehmensteams",- "5Wwopw": "Preise",- "vYmJVk": "Starten Sie Ihre 7-tägige kostenlose Testversion — keine Kreditkartengebühren bis zum Ende der Testphase.",+ "GnHuiT": "",+ "vYmJVk": "","UHF9uv": "Ihre Testnutzung","blVqkQ": "Aktuelle Nutzung","O/w//A": "{count} Events",diff --git a/client/messages/en.json b/client/messages/en.jsonindex 6d8915f06..8d19ad4d3 100644--- a/client/messages/en.json+++ b/client/messages/en.json@@ -868,7 +868,7 @@"cdVnd3": "Please select an organization to subscribe.","Po5b4M": "Selected pricing plan not found. Please adjust the slider.","NLmfEq": "Failed to create checkout session.",- "lMJ3zA": "Checkout URL not received.",+ "Xtxl5C": "Checkout session not received.","+bk3BW": "Subscription failed: {message}","9h0k8z": "Monthly pageviews","wYsv4Z": "Monthly",@@ -883,7 +883,7 @@"fr4eNi": "$1 test subscription for development","CnmIg8": "Subscribe ($1)","5dX7fM": "Advanced features for enterprise teams",- "5Wwopw": "Pricing",+ "GnHuiT": "Start for Free","vYmJVk": "Start your 7-day free trial — no credit card charges until the trial ends.","UHF9uv": "Your Trial Usage","blVqkQ": "Current Usage",diff --git a/client/messages/es.json b/client/messages/es.jsonindex 7933255d5..85b2ddf19 100644--- a/client/messages/es.json+++ b/client/messages/es.json@@ -868,7 +868,7 @@"cdVnd3": "Por favor, selecciona una organización para suscribirte.","Po5b4M": "No se encontró el plan de precios seleccionado. Por favor, ajusta el deslizador.","NLmfEq": "Error al crear la sesión de pago.",- "lMJ3zA": "URL de pago no recibida.",+ "Xtxl5C": "","+bk3BW": "Suscripción fallida: {message}","9h0k8z": "Visitas a la página mensuales","wYsv4Z": "Mensual",@@ -883,8 +883,8 @@"fr4eNi": "Suscripción de prueba de $1 para desarrollo","CnmIg8": "Suscribirse ($1)","5dX7fM": "Funciones avanzadas para equipos de la empresa",- "5Wwopw": "Precios",- "vYmJVk": "Comienza tu prueba gratuita de 7 días: no se realizarán cargos en tu tarjeta de crédito hasta que finalice la prueba.",+ "GnHuiT": "",+ "vYmJVk": "","UHF9uv": "Uso de tu prueba","blVqkQ": "Uso actual","O/w//A": "{count} eventos",diff --git a/client/messages/fr.json b/client/messages/fr.jsonindex 17ed25e22..64e002050 100644--- a/client/messages/fr.json+++ b/client/messages/fr.json@@ -868,7 +868,7 @@"cdVnd3": "Veuillez sélectionner une organisation pour vous abonner.","Po5b4M": "Plan tarifaire sélectionné introuvable. Veuillez ajuster le curseur.","NLmfEq": "Échec de la création de la session de paiement.",- "lMJ3zA": "URL de paiement non reçue.",+ "Xtxl5C": "","+bk3BW": "Échec de l'abonnement : {message}","9h0k8z": "Pages vues mensuelles","wYsv4Z": "Mensuel",@@ -883,8 +883,8 @@"fr4eNi": "Abonnement test à 1 $ pour le développement","CnmIg8": "S'abonner (1 $)","5dX7fM": "Fonctionnalités avancées pour les équipes entreprise",- "5Wwopw": "Tarifs",- "vYmJVk": "Commencez votre essai gratuit de 7 jours — aucune facturation par carte bancaire avant la fin de l'essai.",+ "GnHuiT": "",+ "vYmJVk": "","UHF9uv": "Votre utilisation d'essai","blVqkQ": "Utilisation actuelle","O/w//A": "{count} événements",diff --git a/client/messages/it.json b/client/messages/it.jsonindex 59f70d34c..711c482df 100644--- a/client/messages/it.json+++ b/client/messages/it.json@@ -868,7 +868,7 @@"cdVnd3": "Seleziona un'organizzazione per abbonarti.","Po5b4M": "Piano tariffario selezionato non trovato. Regola il cursore.","NLmfEq": "Impossibile creare la sessione di checkout.",- "lMJ3zA": "URL di checkout non ricevuto.",+ "Xtxl5C": "","+bk3BW": "Abbonamento fallito: {message}","9h0k8z": "Visualizzazioni di pagina mensili","wYsv4Z": "Mensile",@@ -883,8 +883,8 @@"fr4eNi": "Abbonamento di prova da 1$ per lo sviluppo","CnmIg8": "Abbonati (1$)","5dX7fM": "Funzionalità avanzate per team aziendali",- "5Wwopw": "Prezzi",- "vYmJVk": "Inizia la tua prova gratuita di 7 giorni — nessun addebito sulla carta di credito fino al termine della prova.",+ "GnHuiT": "",+ "vYmJVk": "","UHF9uv": "Utilizzo in Prova","blVqkQ": "Utilizzo Attuale","O/w//A": "{count} eventi",diff --git a/client/messages/ja.json b/client/messages/ja.jsonindex b23ec3228..e2000e072 100644--- a/client/messages/ja.json+++ b/client/messages/ja.json@@ -868,7 +868,7 @@"cdVnd3": "サブスクリプションする組織を選択してください。","Po5b4M": "選択した料金プランが見つかりません。スライダーを調整してください。","NLmfEq": "チェックアウトセッションの作成に失敗しました。",- "lMJ3zA": "チェックアウトURLが受信されませんでした。",+ "Xtxl5C": "","+bk3BW": "サブスクリプションに失敗しました:{message}","9h0k8z": "月間ページビュー","wYsv4Z": "月額",@@ -883,8 +883,8 @@"fr4eNi": "開発用$1テストサブスクリプション","CnmIg8": "サブスクリプション($1)","5dX7fM": "エンタープライズチーム向けの高度な機能",- "5Wwopw": "料金",- "vYmJVk": "7日間の無料トライアルを開始しましょう。トライアル終了まで、クレジットカードには請求されません。",+ "GnHuiT": "",+ "vYmJVk": "","UHF9uv": "トライアル使用量","blVqkQ": "現在の使用量","O/w//A": "{count}イベント",diff --git a/client/messages/ko.json b/client/messages/ko.jsonindex a805f1ad4..66ffb8271 100644--- a/client/messages/ko.json+++ b/client/messages/ko.json@@ -868,7 +868,7 @@"cdVnd3": "구독하려면 조직을 선택해 주세요.","Po5b4M": "선택한 요금제를 찾을 수 없습니다. 슬라이더를 조정해 주세요.","NLmfEq": "결제 세션 생성에 실패했습니다.",- "lMJ3zA": "결제 URL을 받지 못했습니다.",+ "Xtxl5C": "","+bk3BW": "구독 실패: {message}","9h0k8z": "월별 페이지뷰","wYsv4Z": "월간",@@ -883,8 +883,8 @@"fr4eNi": "개발용 $1 테스트 구독","CnmIg8": "구독 ($1)","5dX7fM": "엔터프라이즈 팀을 위한 고급 기능",- "5Wwopw": "요금제",- "vYmJVk": "7일 무료 체험을 시작하세요 — 체험 기간이 끝날 때까지 신용카드 요금이 청구되지 않습니다.",+ "GnHuiT": "",+ "vYmJVk": "","UHF9uv": "체험판 사용량","blVqkQ": "현재 사용량","O/w//A": "{count}개 이벤트",diff --git a/client/messages/pl.json b/client/messages/pl.jsonindex 7cbabd5c8..941313c92 100644--- a/client/messages/pl.json+++ b/client/messages/pl.json@@ -868,7 +868,7 @@"cdVnd3": "Wybierz organizację, aby subskrybować.","Po5b4M": "Nie znaleziono wybranego planu cenowego. Dostosuj suwak.","NLmfEq": "Nie udało się utworzyć sesji płatności.",- "lMJ3zA": "Nie otrzymano adresu URL płatności.",+ "Xtxl5C": "","+bk3BW": "Subskrypcja nie powiodła się: {message}","9h0k8z": "Miesięczne odsłony","wYsv4Z": "Miesięcznie",@@ -883,8 +883,8 @@"fr4eNi": "Subskrypcja testowa za $1 do celów deweloperskich","CnmIg8": "Subskrybuj ($1)","5dX7fM": "Zaawansowane funkcje dla zespołów korporacyjnych",- "5Wwopw": "Cennik",- "vYmJVk": "Rozpocznij 7-dniowy bezpłatny okres próbny — karta kredytowa nie zostanie obciążona do końca okresu próbnego.",+ "GnHuiT": "",+ "vYmJVk": "","UHF9uv": "Twoje wykorzystanie wersji próbnej","blVqkQ": "Bieżące wykorzystanie","O/w//A": "{count} zdarzeń",diff --git a/client/messages/pt.json b/client/messages/pt.jsonindex 82ac53ff3..f61c5a181 100644--- a/client/messages/pt.json+++ b/client/messages/pt.json@@ -868,7 +868,7 @@"cdVnd3": "Por favor, selecione uma organização para assinar.","Po5b4M": "Plano de preços selecionado não encontrado. Por favor, ajuste o controle deslizante.","NLmfEq": "Falha ao criar sessão de checkout.",- "lMJ3zA": "URL de checkout não recebida.",+ "Xtxl5C": "","+bk3BW": "Assinatura falhou: {message}","9h0k8z": "Visualizações de página mensais","wYsv4Z": "Mensal",@@ -883,8 +883,8 @@"fr4eNi": "Assinatura de teste de $1 para desenvolvimento","CnmIg8": "Assinar ($1)","5dX7fM": "Recursos avançados para equipes empresariais",- "5Wwopw": "Preços",- "vYmJVk": "Comece sua avaliação gratuita de 7 dias — nenhuma cobrança no cartão de crédito até o término do período de avaliação.",+ "GnHuiT": "",+ "vYmJVk": "","UHF9uv": "Seu Uso no Teste","blVqkQ": "Uso Atual","O/w//A": "{count} eventos",diff --git a/client/messages/zh.json b/client/messages/zh.jsonindex fe119ed80..4c15a9473 100644--- a/client/messages/zh.json+++ b/client/messages/zh.json@@ -868,7 +868,7 @@"cdVnd3": "请选择一个组织进行订阅。","Po5b4M": "未找到选定的定价计划。请调整滑块。","NLmfEq": "创建结账会话失败。",- "lMJ3zA": "未收到结账 URL。",+ "Xtxl5C": "","+bk3BW": "订阅失败:{message}","9h0k8z": "每月页面浏览量","wYsv4Z": "包月",@@ -883,8 +883,8 @@"fr4eNi": "$1 的开发测试订阅","CnmIg8": "订阅 ($1)","5dX7fM": "面向企业团队的高级功能",- "5Wwopw": "定价",- "vYmJVk": "开始您的 7 天免费试用——试用期结束前不会产生任何信用卡费用。",+ "GnHuiT": "",+ "vYmJVk": "","UHF9uv": "您的试用版使用情况","blVqkQ": "当前使用量","O/w//A": "{count} 个事件",diff --git a/client/package-lock.json b/client/package-lock.jsonindex 814f17f14..425f189d6 100644--- a/client/package-lock.json+++ b/client/package-lock.json@@ -35,6 +35,8 @@"@radix-ui/react-tooltip": "1.2.6","@radix-ui/react-visually-hidden": "1.2.4","@rybbit/shared": "file:../shared",+ "@stripe/react-stripe-js": "^5.6.0",+ "@stripe/stripe-js": "^8.8.0","@tailwindcss/postcss": "^4.1.17","@tanstack/react-query": "5.76.0","@tanstack/react-query-devtools": "5.76.0",@@ -4831,6 +4833,29 @@"integrity": "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==","license": "MIT"},+ "node_modules/@stripe/react-stripe-js": {+ "version": "5.6.0",+ "resolved": "https://registry.npmjs.org/@stripe/react-stripe-js/-/react-stripe-js-5.6.0.tgz",+ "integrity": "sha512-tucu/vTGc+5NXbo2pUiaVjA4ENdRBET8qGS00BM4BAU8J4Pi3eY6BHollsP2+VSuzzlvXwMg0it3ZLhbCj2fPg==",+ "license": "MIT",+ "dependencies": {+ "prop-types": "^15.7.2"+ },+ "peerDependencies": {+ "@stripe/stripe-js": ">=8.0.0 <9.0.0",+ "react": ">=16.8.0 <20.0.0",+ "react-dom": ">=16.8.0 <20.0.0"+ }+ },+ "node_modules/@stripe/stripe-js": {+ "version": "8.8.0",+ "resolved": "https://registry.npmjs.org/@stripe/stripe-js/-/stripe-js-8.8.0.tgz",+ "integrity": "sha512-NNYuyW8qmLjyHnpyFgs/23wUrjB8k0xN9YIZFOMLewCa/pIkIji9e9aY/EgdNryEDDRptc6TcPIHRvG1R0ClFw==",+ "license": "MIT",+ "engines": {+ "node": ">=12.16"+ }+ },"node_modules/@swc/core-darwin-arm64": {"version": "1.15.11","resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.15.11.tgz",diff --git a/client/package.json b/client/package.jsonindex 1521613c4..a8ff3bd1b 100644--- a/client/package.json+++ b/client/package.json@@ -40,6 +40,8 @@"@radix-ui/react-tooltip": "1.2.6","@radix-ui/react-visually-hidden": "1.2.4","@rybbit/shared": "file:../shared",+ "@stripe/react-stripe-js": "^5.6.0",+ "@stripe/stripe-js": "^8.8.0","@tailwindcss/postcss": "^4.1.17","@tanstack/react-query": "5.76.0","@tanstack/react-query-devtools": "5.76.0",diff --git a/client/src/app/subscribe/components/PricingCards.tsx b/client/src/app/subscribe/components/PricingCards.tsxindex 410b71909..9a0637227 100644--- a/client/src/app/subscribe/components/PricingCards.tsx+++ b/client/src/app/subscribe/components/PricingCards.tsx@@ -19,6 +19,7 @@ import {formatEventTier} from "./utils";+import { CheckoutModal } from "@/components/subscription/CheckoutModal";import { useRouter } from "next/navigation";import { useQueryState } from "nuqs";@@ -31,6 +32,7 @@ export function PricingCards({ isLoggedIn }: { isLoggedIn: boolean }) {const [isAnnual, setIsAnnual] = useState<boolean>(true);const [isLoading, setIsLoading] = useState<boolean>(false);const [showTestPlan, setShowTestPlan] = useState(false);+ const [checkoutClientSecret, setCheckoutClientSecret] = useState<string | null>(null);const { data: activeOrg } = authClient.useActiveOrganization();useEffect(() => {@@ -74,12 +76,10 @@ export function PricingCards({ isLoggedIn }: { isLoggedIn: boolean }) {setIsLoading(true);try {- // Use NEXT_PUBLIC_BACKEND_URL if available, otherwise use relative path for same-origin requestsconst baseUrl = window.location.origin;- const successUrl = siteId+ const returnUrl = siteId? `${baseUrl}/${siteId}?session_id={CHECKOUT_SESSION_ID}`: `${baseUrl}/settings/organization/subscription?session_id={CHECKOUT_SESSION_ID}`;- const cancelUrl = `${baseUrl}/subscribe${siteId ? `?siteId=${siteId}` : ""}`;const response = await fetch(`${BACKEND_URL}/stripe/create-checkout-session`, {method: "POST",@@ -89,8 +89,7 @@ export function PricingCards({ isLoggedIn }: { isLoggedIn: boolean }) {credentials: "include", // Send cookiesbody: JSON.stringify({priceId: selectedTierPrice.priceId,- successUrl: successUrl,- cancelUrl: cancelUrl,+ returnUrl,organizationId: activeOrg.id,referral: window.Rewardful?.referral || undefined,}),@@ -103,11 +102,12 @@ export function PricingCards({ isLoggedIn }: { isLoggedIn: boolean }) {throw new Error(data.error || t("Failed to create checkout session."));}- if (data.checkoutUrl) {- window.location.href = data.checkoutUrl; // Redirect to Stripe checkout+ if (data.clientSecret) {+ setCheckoutClientSecret(data.clientSecret);} else {- throw new Error(t("Checkout URL not received."));+ throw new Error(t("Checkout session not received."));}+ setIsLoading(false);} catch (error: any) {toast.error(t("Subscription failed: {message}", { message: error.message }));setIsLoading(false); // Stop loading on error@@ -127,10 +127,9 @@ export function PricingCards({ isLoggedIn }: { isLoggedIn: boolean }) {setIsLoading(true);try {const baseUrl = window.location.origin;- const successUrl = siteId+ const returnUrl = siteId? `${baseUrl}/${siteId}?session_id={CHECKOUT_SESSION_ID}`: `${baseUrl}/settings/organization/subscription?session_id={CHECKOUT_SESSION_ID}`;- const cancelUrl = `${baseUrl}/subscribe${siteId ? `?siteId=${siteId}` : ""}`;const response = await fetch(`${BACKEND_URL}/stripe/create-checkout-session`, {method: "POST",@@ -138,8 +137,7 @@ export function PricingCards({ isLoggedIn }: { isLoggedIn: boolean }) {credentials: "include",body: JSON.stringify({priceId: "price_1SzT8pDFVprnAny2EdkqxRAZ",- successUrl,- cancelUrl,+ returnUrl,organizationId: activeOrg.id,referral: window.Rewardful?.referral || undefined,}),@@ -151,11 +149,12 @@ export function PricingCards({ isLoggedIn }: { isLoggedIn: boolean }) {throw new Error(data.error || t("Failed to create checkout session."));}- if (data.checkoutUrl) {- window.location.href = data.checkoutUrl;+ if (data.clientSecret) {+ setCheckoutClientSecret(data.clientSecret);} else {- throw new Error(t("Checkout URL not received."));+ throw new Error(t("Checkout session not received."));}+ setIsLoading(false);} catch (error: any) {toast.error(t("Subscription failed: {message}", { message: error.message }));setIsLoading(false);@@ -178,143 +177,150 @@ export function PricingCards({ isLoggedIn }: { isLoggedIn: boolean }) {const isCustomTier = eventLimit === "Custom";return (- <div className="max-w-[1300px] mx-auto">- {/* Shared controls section */}- <div className="max-w-xl mx-auto mb-8">- <div className="flex justify-between mb-6 items-center">- <div>- <h3 className="font-semibold mb-2">{t("Monthly pageviews")}</h3>- <div className="text-3xl font-bold text-emerald-400">- {typeof eventLimit === "number" ? eventLimit.toLocaleString() : eventLimit}+ <>+ <CheckoutModal+ clientSecret={checkoutClientSecret}+ open={!!checkoutClientSecret}+ onOpenChange={(open) => { if (!open) setCheckoutClientSecret(null); }}+ />+ <div className="max-w-[1300px] mx-auto">+ {/* Shared controls section */}+ <div className="max-w-xl mx-auto mb-8">+ <div className="flex justify-between mb-6 items-center">+ <div>+ <h3 className="font-semibold mb-2">{t("Monthly pageviews")}</h3>+ <div className="text-3xl font-bold text-emerald-400">+ {typeof eventLimit === "number" ? eventLimit.toLocaleString() : eventLimit}+ </div></div>- </div>- <div className="flex flex-col items-end">- {/* Billing toggle */}- <div className="relative flex items-center">- <div className="flex bg-neutral-150 dark:bg-neutral-850 border border-neutral-250 dark:border-neutral-750 rounded-full p-1 text-sm">- <button- onClick={() => setIsAnnual(false)}- className={cn(- "px-3 py-1 rounded-full transition-colors cursor-pointer",- !isAnnual- ? "bg-white dark:bg-white/20 text-neutral-700 dark:text-neutral-100 font-medium"- : "text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-neutral-200"- )}- >- {t("Monthly")}- </button>- <button- onClick={() => setIsAnnual(true)}- className={cn(- "px-3 py-1 rounded-full transition-colors cursor-pointer",- isAnnual- ? "bg-white dark:bg-white/20 text-neutral-700 dark:text-neutral-100 font-medium"- : "text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-neutral-200"- )}- >- {t("Annual")}- </button>+ <div className="flex flex-col items-end">+ {/* Billing toggle */}+ <div className="relative flex items-center">+ <div className="flex bg-neutral-150 dark:bg-neutral-850 border border-neutral-250 dark:border-neutral-750 rounded-full p-1 text-sm">+ <button+ onClick={() => setIsAnnual(false)}+ className={cn(+ "px-3 py-1 rounded-full transition-colors cursor-pointer",+ !isAnnual+ ? "bg-white dark:bg-white/20 text-neutral-700 dark:text-neutral-100 font-medium"+ : "text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-neutral-200"+ )}+ >+ {t("Monthly")}+ </button>+ <button+ onClick={() => setIsAnnual(true)}+ className={cn(+ "px-3 py-1 rounded-full transition-colors cursor-pointer",+ isAnnual+ ? "bg-white dark:bg-white/20 text-neutral-700 dark:text-neutral-100 font-medium"+ : "text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-neutral-200"+ )}+ >+ {t("Annual")}+ </button>+ </div>+ <span className="absolute -top-3 -right-12 text-xs text-white bg-emerald-500 border border-emerald-500 rounded-full px-2 py-0.5 whitespace-nowrap">+ {t("4 months free")}+ </span></div>- <span className="absolute -top-3 -right-12 text-xs text-white bg-emerald-500 border border-emerald-500 rounded-full px-2 py-0.5 whitespace-nowrap">- {t("4 months free")}- </span></div></div>- </div>- {/* Slider */}- <Slider- defaultValue={[0]}- max={EVENT_TIERS.length - 1}- min={0}- step={1}- onValueChange={handleSliderChange}- className="mb-3"- />+ {/* Slider */}+ <Slider+ defaultValue={[0]}+ max={EVENT_TIERS.length - 1}+ min={0}+ step={1}+ onValueChange={handleSliderChange}+ className="mb-3"+ />- <div className="flex justify-between text-xs text-neutral-600 dark:text-neutral-400">- {EVENT_TIERS.map((tier, index) => (- <span- key={index}- className={cn(eventLimitIndex === index && "font-bold text-emerald-600 dark:text-emerald-400")}- >- {index === EVENT_TIERS.length - 1 && typeof tier !== "number"- ? "20M+"- : formatEventTier(tier)}- </span>- ))}+ <div className="flex justify-between text-xs text-neutral-600 dark:text-neutral-400">+ {EVENT_TIERS.map((tier, index) => (+ <span+ key={index}+ className={cn(eventLimitIndex === index && "font-bold text-emerald-600 dark:text-emerald-400")}+ >+ {index === EVENT_TIERS.length - 1 && typeof tier !== "number"+ ? "20M+"+ : formatEventTier(tier)}+ </span>+ ))}+ </div></div>- </div>- {/* Cards section */}- <div className="grid min-[1100px]:grid-cols-4 min-[700px]:grid-cols-2 min-[400px]:grid-cols-1 gap-4 mx-auto mb-16">- <div className={cn("h-full", !isBasicAvailable && "opacity-60")}>+ {/* Cards section */}+ <div className="grid min-[1100px]:grid-cols-4 min-[700px]:grid-cols-2 min-[400px]:grid-cols-1 gap-4 mx-auto mb-16">+ <div className={cn("h-full", !isBasicAvailable && "opacity-60")}>+ <PricingCard+ title="Basic"+ description={t("For personal projects and small sites")}+ monthlyPrice={basicMonthlyPrice}+ annualPrice={basicAnnualPrice}+ isAnnual={isAnnual}+ isCustomTier={!isBasicAvailable}+ customPriceLabel="-"+ buttonText={!isBasicAvailable ? t("Up to 250k only") : isLoading ? t("Processing...") : t("Start free trial")}+ features={BASIC_FEATURES}+ onClick={() => handleSubscribe("basic")}+ disabled={isLoading || !isBasicAvailable}+ />+ </div><PricingCard- title="Basic"- description={t("For personal projects and small sites")}- monthlyPrice={basicMonthlyPrice}- annualPrice={basicAnnualPrice}+ title="Standard"+ description={t("Everything you need to get started as a small business")}+ monthlyPrice={standardMonthlyPrice}+ annualPrice={standardAnnualPrice}isAnnual={isAnnual}- isCustomTier={!isBasicAvailable}- customPriceLabel="-"- buttonText={!isBasicAvailable ? t("Up to 250k only") : isLoading ? t("Processing...") : t("Start free trial")}- features={BASIC_FEATURES}- onClick={() => handleSubscribe("basic")}- disabled={isLoading || !isBasicAvailable}+ isCustomTier={isCustomTier}+ buttonText={isLoading ? t("Processing...") : isCustomTier ? t("Contact us") : t("Start free trial")}+ features={STANDARD_FEATURES}+ onClick={() => handleSubscribe("standard")}+ disabled={isLoading}/>- </div>- <PricingCard- title="Standard"- description={t("Everything you need to get started as a small business")}- monthlyPrice={standardMonthlyPrice}- annualPrice={standardAnnualPrice}- isAnnual={isAnnual}- isCustomTier={isCustomTier}- buttonText={isLoading ? t("Processing...") : isCustomTier ? t("Contact us") : t("Start free trial")}- features={STANDARD_FEATURES}- onClick={() => handleSubscribe("standard")}- disabled={isLoading}- />- <PricingCard- title="Pro"- description={t("Advanced features for professional teams")}- isCustomTier={isCustomTier}- monthlyPrice={proMonthlyPrice}- annualPrice={proAnnualPrice}- isAnnual={isAnnual}- buttonText={isLoading ? t("Processing...") : isCustomTier ? t("Contact us") : t("Start free trial")}- features={PRO_FEATURES}- recommended={true}- onClick={() => handleSubscribe("pro")}- disabled={isLoading}- />-- {showTestPlan && (<PricingCard- title="Test"- description={t("$1 test subscription for development")}+ title="Pro"+ description={t("Advanced features for professional teams")}isCustomTier={isCustomTier}- buttonText={isLoading ? t("Processing...") : t("Subscribe ($1)")}- features={["Test plan"]}- onClick={() => handleTestSubscribe()}+ monthlyPrice={proMonthlyPrice}+ annualPrice={proAnnualPrice}+ isAnnual={isAnnual}+ buttonText={isLoading ? t("Processing...") : isCustomTier ? t("Contact us") : t("Start free trial")}+ features={PRO_FEATURES}+ recommended={true}+ onClick={() => handleSubscribe("pro")}disabled={isLoading}/>- )}- <PricingCard- title="Enterprise"- description={t("Advanced features for enterprise teams")}- features={ENTERPRISE_FEATURES}- isCustomTier={true}- customButton={- <a href="https://www.rybbit.com/contact" className="w-full block">- <button className="w-full bg-emerald-600 hover:bg-emerald-500 text-white font-medium px-5 py-3 rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:ring-opacity-50 cursor-pointer">- {t("Contact us")}- </button>- </a>- }- />+ {showTestPlan && (+ <PricingCard+ title="Test"+ description={t("$1 test subscription for development")}+ isCustomTier={isCustomTier}+ buttonText={isLoading ? t("Processing...") : t("Subscribe ($1)")}+ features={["Test plan"]}+ onClick={() => handleTestSubscribe()}+ disabled={isLoading}+ />+ )}++ <PricingCard+ title="Enterprise"+ description={t("Advanced features for enterprise teams")}+ features={ENTERPRISE_FEATURES}+ isCustomTier={true}+ customButton={+ <a href="https://www.rybbit.com/contact" className="w-full block">+ <button className="w-full bg-emerald-600 hover:bg-emerald-500 text-white font-medium px-5 py-3 rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:ring-opacity-50 cursor-pointer">+ {t("Contact us")}+ </button>+ </a>+ }+ />+ </div></div>- </div>+ </>);}diff --git a/client/src/app/subscribe/components/PricingHeader.tsx b/client/src/app/subscribe/components/PricingHeader.tsxindex bcec751cd..43ac07cf2 100644--- a/client/src/app/subscribe/components/PricingHeader.tsx+++ b/client/src/app/subscribe/components/PricingHeader.tsx@@ -1,12 +1,11 @@import { useExtracted } from "next-intl";-import React from "react";export function PricingHeader() {const t = useExtracted();return (<div className="mb-10 text-center max-w-3xl mx-auto"><h1 className="text-4xl md:text-5xl font-bold tracking-tight pb-4 text-transparent bg-clip-text bg-linear-to-b from-neutral-900 via-neutral-700 to-neutral-500 dark:from-white dark:via-gray-200 dark:to-gray-400">- {t("Pricing")}+ {t("Start for Free")}</h1><p className="text-lg text-neutral-600 dark:text-neutral-300 mb-6">{t("Start your 7-day free trial — no credit card charges until the trial ends.")}</p></div>diff --git a/client/src/components/subscription/CheckoutModal.tsx b/client/src/components/subscription/CheckoutModal.tsxnew file mode 100644index 000000000..04bee6742--- /dev/null+++ b/client/src/components/subscription/CheckoutModal.tsx@@ -0,0 +1,26 @@+"use client";+import { loadStripe } from "@stripe/stripe-js";+import { EmbeddedCheckout, EmbeddedCheckoutProvider } from "@stripe/react-stripe-js";+import { Dialog, DialogContent } from "@/components/ui/dialog";+import { STRIPE_PUBLISHABLE_KEY } from "@/lib/const";++const stripePromise = loadStripe(STRIPE_PUBLISHABLE_KEY);++interface CheckoutModalProps {+ clientSecret: string | null;+ open: boolean;+ onOpenChange: (open: boolean) => void;+}++export function CheckoutModal({ clientSecret, open, onOpenChange }: CheckoutModalProps) {+ if (!clientSecret) return null;+ return (+ <Dialog open={open} onOpenChange={onOpenChange}>+ <DialogContent className="max-w-[1000px] py-8 px-0 overflow-hidden bg-[#1a1a1a] dark:bg-[#1a1a1a] border-neutral-800 dark:border-neutral-800">+ <EmbeddedCheckoutProvider key={clientSecret} stripe={stripePromise} options={{ clientSecret }}>+ <EmbeddedCheckout />+ </EmbeddedCheckoutProvider>+ </DialogContent>+ </Dialog>+ );+}diff --git a/client/src/components/subscription/PaidPlain/PlanDialog.tsx b/client/src/components/subscription/PaidPlain/PlanDialog.tsxindex 87a79e170..56f5e7810 100644--- a/client/src/components/subscription/PaidPlain/PlanDialog.tsx+++ b/client/src/components/subscription/PaidPlain/PlanDialog.tsx@@ -6,6 +6,7 @@ import { getStripePrices, STRIPE_TIERS } from "@/lib/stripe";import { usePreviewSubscriptionUpdate, useUpdateSubscription } from "@/lib/subscription/useSubscriptionMutations";import { cn } from "@/lib/utils";import { useState } from "react";+import { CheckoutModal } from "../CheckoutModal";import { PlanChangePreviewDialog } from "./PlanChangePreviewDialog";interface PlanDialogProps {@@ -20,6 +21,7 @@ export function PlanDialog({ open, onOpenChange, currentPlanName, hasActiveSubscconst [showProrationDialog, setShowProrationDialog] = useState(false);const [pendingPriceId, setPendingPriceId] = useState<string | null>(null);const [pendingPlanName, setPendingPlanName] = useState<string | null>(null);+ const [checkoutClientSecret, setCheckoutClientSecret] = useState<string | null>(null);const stripePrices = getStripePrices();const { data: activeOrg } = authClient.useActiveOrganization();const previewMutation = usePreviewSubscriptionUpdate();@@ -52,8 +54,7 @@ export function PlanDialog({ open, onOpenChange, currentPlanName, hasActiveSubscsetShowProrationDialog(true);} else {// For new subscriptions, create a checkout session- const successUrl = `${baseUrl}/settings/organization/subscription?session_id={CHECKOUT_SESSION_ID}`;- const cancelUrl = `${baseUrl}/settings/organization/subscription`;+ const returnUrl = `${baseUrl}/settings/organization/subscription?session_id={CHECKOUT_SESSION_ID}`;const response = await fetch(`${BACKEND_URL}/stripe/create-checkout-session`, {method: "POST",@@ -63,8 +64,7 @@ export function PlanDialog({ open, onOpenChange, currentPlanName, hasActiveSubsccredentials: "include",body: JSON.stringify({priceId,- successUrl,- cancelUrl,+ returnUrl,organizationId: activeOrg.id,referral: window.Rewardful?.referral || undefined,}),@@ -76,10 +76,11 @@ export function PlanDialog({ open, onOpenChange, currentPlanName, hasActiveSubscthrow new Error(data.error || "Failed to create checkout session.");}- if (data.checkoutUrl) {- window.location.href = data.checkoutUrl;+ if (data.clientSecret) {+ setCheckoutClientSecret(data.clientSecret);+ onOpenChange(false); // close plan selection dialog} else {- throw new Error("Checkout URL not received.");+ throw new Error("Checkout session not received.");}}} catch (error: any) {@@ -244,6 +245,11 @@ export function PlanDialog({ open, onOpenChange, currentPlanName, hasActiveSubsconCancel={handlePreviewCancel}isUpdating={updateMutation.isPending}/>+ <CheckoutModal+ clientSecret={checkoutClientSecret}+ open={!!checkoutClientSecret}+ onOpenChange={(open) => { if (!open) setCheckoutClientSecret(null); }}+ /></>);}diff --git a/client/src/lib/const.ts b/client/src/lib/const.tsindex 30a3c390a..a3715541d 100644--- a/client/src/lib/const.ts+++ b/client/src/lib/const.ts@@ -2,6 +2,7 @@ export const BACKEND_URL =process.env.NEXT_PUBLIC_BACKEND_URL === "http://localhost:3001"? "http://localhost:3001/api": `${process.env.NEXT_PUBLIC_BACKEND_URL}/api`;+export const STRIPE_PUBLISHABLE_KEY = process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY ?? "";export const IS_CLOUD = process.env.NEXT_PUBLIC_CLOUD === "true";// Time constantsdiff --git a/docker-compose.cloud.yml b/docker-compose.cloud.ymlindex 86190866c..45d0124ea 100644--- a/docker-compose.cloud.yml+++ b/docker-compose.cloud.yml@@ -150,6 +150,7 @@ services:NEXT_PUBLIC_CLOUD: ${CLOUD}NEXT_PUBLIC_MAPBOX_TOKEN: ${MAPBOX_TOKEN}NEXT_PUBLIC_TURNSTILE_SITE_KEY: ${TURNSTILE_SITE_KEY}+ NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: ${STRIPE_PUBLISHABLE_KEY}environment:- NODE_ENV=production- NEXT_PUBLIC_BACKEND_URL=${BASE_URL}@@ -157,6 +158,7 @@ services:- NEXT_PUBLIC_CLOUD=${CLOUD}- NEXT_PUBLIC_MAPBOX_TOKEN=${MAPBOX_TOKEN}- NEXT_PUBLIC_TURNSTILE_SITE_KEY=${TURNSTILE_SITE_KEY}+ - NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=${STRIPE_PUBLISHABLE_KEY}depends_on:- backendrestart: unless-stoppeddiff --git a/docs/messages/de.json b/docs/messages/de.jsonindex 552cbd1a8..50cc4be0a 100644--- a/docs/messages/de.json+++ b/docs/messages/de.json@@ -46,7 +46,7 @@"j8QCz9": "Vergleichen Sie die wichtigsten Funktionen von Rybbit und {competitor}.","M0QQUY": "Ihre Website tracken","k6I8wU": "Live-Demo",- "bA6bCb": "7-tägige kostenlose Testversion.",+ "PFR6eX": "","CIZcQY": "Warum Rybbit statt {competitor}?","hZOGLS": "Kontakt","bZ6o5N": "Haben Sie Fragen zu Rybbit? Wir helfen Ihnen gerne! Kontaktieren Sie uns über einen dieser Kanäle:",@@ -143,7 +143,7 @@"T/yWuy": "Vollständiger API-Zugang zum Abfragen Ihrer Daten und zum Erstellen benutzerdefinierter Integrationen.","hEeLPx": "Alles, was Sie brauchen, um Ihr Publikum zu verstehen","jT0EEm": "Leistungsstarke Analytics ohne Komplexität. Verfolgen, analysieren und optimieren Sie Ihre Website mit datenschutzfreundlichen Tools, die einfach funktionieren.",- "KV7xeN": "Kostenlos testen",+ "0Ha+fM": "","iGB6GJ": "Kern-Web-Analytics","Tw0saF": "Verfolgen Sie jede wichtige Kennzahl. Treffen Sie datengestützte Entscheidungen mit umfassender Analytics, die auf Klarheit ausgelegt ist.","WYPIM3": "Erweiterte Analytics",diff --git a/docs/messages/en.json b/docs/messages/en.jsonindex c15212512..27a5c892e 100644--- a/docs/messages/en.json+++ b/docs/messages/en.json@@ -46,7 +46,7 @@"j8QCz9": "Compare the key features of Rybbit and {competitor}.","M0QQUY": "Track your site","k6I8wU": "Live demo",- "bA6bCb": "7-day free trial.",+ "PFR6eX": "7-day free trial","CIZcQY": "Why choose Rybbit over {competitor}?","hZOGLS": "Contact Us","bZ6o5N": "Have questions about Rybbit? We're here to help! Reach out to us through any of these channels:",@@ -143,7 +143,7 @@"T/yWuy": "Full API access to query your data and build custom integrations.","hEeLPx": "Everything you need to understand your audience","jT0EEm": "Powerful analytics without the complexity. Track, analyze, and optimize your website with privacy-friendly tools that just work.",- "KV7xeN": "Start free trial",+ "0Ha+fM": "Start for $0","iGB6GJ": "Core Web Analytics","Tw0saF": "Track every metric that matters. Make data-driven decisions with comprehensive analytics designed for clarity.","WYPIM3": "Advanced Analytics",diff --git a/docs/messages/es.json b/docs/messages/es.jsonindex 2483aaeb2..df1c085f7 100644--- a/docs/messages/es.json+++ b/docs/messages/es.json@@ -46,7 +46,7 @@"j8QCz9": "Compara las características principales de Rybbit y {competitor}.","M0QQUY": "Rastrea tu sitio","k6I8wU": "Demo en vivo",- "bA6bCb": "Prueba gratuita de 7 días.",+ "PFR6eX": "","CIZcQY": "¿Por qué elegir Rybbit sobre {competitor}?","hZOGLS": "Contáctanos","bZ6o5N": "¿Tienes preguntas sobre Rybbit? ¡Estamos aquí para ayudarte! Comunícate con nosotros a través de cualquiera de estos canales:",@@ -143,7 +143,7 @@"T/yWuy": "Acceso completo a la API para consultar tus datos y crear integraciones personalizadas.","hEeLPx": "Todo lo que necesitas para entender a tu audiencia","jT0EEm": "Análisis potentes sin la complejidad. Rastrea, analiza y optimiza tu sitio web con herramientas respetuosas de la privacidad que simplemente funcionan.",- "KV7xeN": "Comenzar prueba gratuita",+ "0Ha+fM": "","iGB6GJ": "Análisis Web Básico","Tw0saF": "Rastrea cada métrica que importa. Toma decisiones basadas en datos con análisis completos diseñados para mayor claridad.","WYPIM3": "Análisis Avanzado",diff --git a/docs/messages/fr.json b/docs/messages/fr.jsonindex 67eba6bf9..6e9a8157f 100644--- a/docs/messages/fr.json+++ b/docs/messages/fr.json@@ -46,7 +46,7 @@"j8QCz9": "Comparez les fonctionnalités clés de Rybbit et de {competitor}.","M0QQUY": "Suivez votre site","k6I8wU": "Démo en direct",- "bA6bCb": "7 jours d'essai gratuit.",+ "PFR6eX": "","CIZcQY": "Pourquoi choisir Rybbit plutôt que {competitor} ?","hZOGLS": "Nous contacter","bZ6o5N": "Vous avez des questions sur Rybbit ? Nous sommes là pour vous aider ! Contactez-nous via l'un de ces canaux :",@@ -143,7 +143,7 @@"T/yWuy": "Accès API complet pour interroger vos données et créer des intégrations personnalisées.","hEeLPx": "Tout ce dont vous avez besoin pour comprendre votre audience","jT0EEm": "Des analyses puissantes sans la complexité. Suivez, analysez et optimisez votre site web avec des outils respectueux de la vie privée qui fonctionnent simplement.",- "KV7xeN": "Commencer l'essai gratuit",+ "0Ha+fM": "","iGB6GJ": "Analytique web de base","Tw0saF": "Suivez chaque métrique qui compte. Prenez des décisions basées sur les données grâce à des analyses complètes conçues pour la clarté.","WYPIM3": "Analytique avancée",diff --git a/docs/messages/it.json b/docs/messages/it.jsonindex 80bd17cc7..c1a98c77f 100644--- a/docs/messages/it.json+++ b/docs/messages/it.json@@ -46,7 +46,7 @@"j8QCz9": "Confronta le funzionalità principali di Rybbit e {competitor}.","M0QQUY": "Monitora il tuo sito","k6I8wU": "Demo live",- "bA6bCb": "7 giorni di prova gratuita.",+ "PFR6eX": "","CIZcQY": "Perché scegliere Rybbit invece di {competitor}?","hZOGLS": "Contattaci","bZ6o5N": "Hai domande su Rybbit? Siamo qui per aiutarti! Contattaci attraverso uno di questi canali:",@@ -143,7 +143,7 @@"T/yWuy": "Accesso API completo per interrogare i tuoi dati e creare integrazioni personalizzate.","hEeLPx": "Tutto ciò di cui hai bisogno per comprendere il tuo pubblico","jT0EEm": "Analisi potente senza complessità. Monitora, analizza e ottimizza il tuo sito web con strumenti rispettosi della privacy che funzionano semplicemente.",- "KV7xeN": "Inizia la prova gratuita",+ "0Ha+fM": "","iGB6GJ": "Analisi Web di Base","Tw0saF": "Monitora ogni metrica che conta. Prendi decisioni basate sui dati con analisi complete progettate per la chiarezza.","WYPIM3": "Analisi Avanzata",diff --git a/docs/messages/ja.json b/docs/messages/ja.jsonindex 93ce6a518..151ad8552 100644--- a/docs/messages/ja.json+++ b/docs/messages/ja.json@@ -46,7 +46,7 @@"j8QCz9": "Rybbitと{competitor}の主要機能を比較します。","M0QQUY": "サイトを追跡する","k6I8wU": "ライブデモ",- "bA6bCb": "7日間無料トライアル。",+ "PFR6eX": "","CIZcQY": "{competitor}よりRybbitを選ぶ理由","hZOGLS": "お問い合わせ","bZ6o5N": "Rybbitについてご質問がありますか? お気軽にご連絡ください。以下のいずれかのチャンネルからお問い合わせいただけます:",@@ -143,7 +143,7 @@"T/yWuy": "データのクエリとカスタムインテグレーション構築のための完全なAPIアクセス。","hEeLPx": "オーディエンスを理解するために必要なすべてが揃っています","jT0EEm": "複雑さのない強力な分析。プライバシーに配慮したツールで、ウェブサイトを追跡、分析、最適化できます。",- "KV7xeN": "無料トライアルを開始",+ "0Ha+fM": "","iGB6GJ": "コアウェブ分析","Tw0saF": "重要なすべての指標を追跡します。明確さのために設計された包括的な分析でデータドリブンな意思決定を行います。","WYPIM3": "高度な分析",diff --git a/docs/messages/ko.json b/docs/messages/ko.jsonindex bcbde0b63..4aac9ce7f 100644--- a/docs/messages/ko.json+++ b/docs/messages/ko.json@@ -46,7 +46,7 @@"j8QCz9": "Rybbit과 {competitor}의 주요 기능을 비교해 보세요.","M0QQUY": "사이트 추적하기","k6I8wU": "라이브 데모",- "bA6bCb": "7일 무료 체험.",+ "PFR6eX": "","CIZcQY": "{competitor} 대신 Rybbit을 선택해야 하는 이유는?","hZOGLS": "문의하기","bZ6o5N": "Rybbit에 대해 궁금한 점이 있으신가요? 언제든지 도와드리겠습니다! 다음 채널을 통해 문의해 주세요:",@@ -143,7 +143,7 @@"T/yWuy": "데이터 쿼리 및 커스텀 통합 구축을 위한 완전한 API 액세스.","hEeLPx": "오디언스를 이해하는 데 필요한 모든 것","jT0EEm": "복잡함 없는 강력한 분석. 그냥 작동하는 프라이버시 친화적인 도구로 웹사이트를 추적, 분석, 최적화하세요.",- "KV7xeN": "무료 체험 시작",+ "0Ha+fM": "","iGB6GJ": "핵심 웹 분석","Tw0saF": "중요한 모든 지표를 추적하세요. 명확성을 위해 설계된 포괄적인 분석으로 데이터 기반 결정을 내리세요.","WYPIM3": "고급 분석",diff --git a/docs/messages/pl.json b/docs/messages/pl.jsonindex f65c26f08..2e6231078 100644--- a/docs/messages/pl.json+++ b/docs/messages/pl.json@@ -46,7 +46,7 @@"j8QCz9": "Porównaj kluczowe funkcje Rybbit i {competitor}.","M0QQUY": "Śledź swoją witrynę","k6I8wU": "Demo na żywo",- "bA6bCb": "7-dniowy bezpłatny okres próbny.",+ "PFR6eX": "","CIZcQY": "Dlaczego wybrać Rybbit zamiast {competitor}?","hZOGLS": "Skontaktuj się z Nami","bZ6o5N": "Masz pytania dotyczące Rybbit? Jesteśmy tu, aby pomóc! Skontaktuj się z nami przez jeden z tych kanałów:",@@ -143,7 +143,7 @@"T/yWuy": "Pełny dostęp do API, umożliwiający zapytania o dane i tworzenie niestandardowych integracji.","hEeLPx": "Wszystko, czego potrzebujesz, aby poznać swoich odbiorców","jT0EEm": "Potężna analityka bez zbędnej złożoności. Śledź, analizuj i optymalizuj swoją witrynę za pomocą przyjaznych prywatności narzędzi, które po prostu działają.",- "KV7xeN": "Rozpocznij bezpłatny okres próbny",+ "0Ha+fM": "","iGB6GJ": "Podstawowa Analityka Internetowa","Tw0saF": "Śledź każdy wskaźnik, który ma znaczenie. Podejmuj decyzje oparte na danych dzięki kompleksowej analityce zaprojektowanej dla przejrzystości.","WYPIM3": "Zaawansowana Analityka",diff --git a/docs/messages/pt.json b/docs/messages/pt.jsonindex 033a4a275..d5064e870 100644--- a/docs/messages/pt.json+++ b/docs/messages/pt.json@@ -46,7 +46,7 @@"j8QCz9": "Compare os principais recursos do Rybbit e {competitor}.","M0QQUY": "Monitore seu site","k6I8wU": "Demo ao vivo",- "bA6bCb": "7 dias de teste grátis.",+ "PFR6eX": "","CIZcQY": "Por que escolher o Rybbit em vez de {competitor}?","hZOGLS": "Fale Conosco","bZ6o5N": "Tem dúvidas sobre o Rybbit? Estamos aqui para ajudar! Entre em contato por qualquer um destes canais:",@@ -143,7 +143,7 @@"T/yWuy": "Acesso completo à API para consultar seus dados e construir integrações personalizadas.","hEeLPx": "Tudo que você precisa para entender seu público","jT0EEm": "Análises poderosas sem a complexidade. Rastreie, analise e otimize seu site com ferramentas que respeitam a privacidade e simplesmente funcionam.",- "KV7xeN": "Iniciar teste grátis",+ "0Ha+fM": "","iGB6GJ": "Análises Web Essenciais","Tw0saF": "Rastreie cada métrica que importa. Tome decisões baseadas em dados com análises abrangentes projetadas para clareza.","WYPIM3": "Análises Avançadas",diff --git a/docs/messages/zh.json b/docs/messages/zh.jsonindex a8587dbe6..1770a4354 100644--- a/docs/messages/zh.json+++ b/docs/messages/zh.json@@ -46,7 +46,7 @@"j8QCz9": "比较 Rybbit 与 {competitor} 的核心功能。","M0QQUY": "追踪您的网站","k6I8wU": "在线演示",- "bA6bCb": "7天免费试用。",+ "PFR6eX": "","CIZcQY": "为什么选择 Rybbit 而非 {competitor}?","hZOGLS": "联系我们","bZ6o5N": "对 Rybbit 有疑问?我们随时为您提供帮助!请通过以下任意渠道联系我们:",@@ -143,7 +143,7 @@"T/yWuy": "完整 API 访问权限,查询数据并构建自定义集成。","hEeLPx": "了解受众所需的一切工具","jT0EEm": "强大的分析能力,无需复杂操作。通过隐私友好的工具追踪、分析和优化您的网站,开箱即用。",- "KV7xeN": "开始免费试用",+ "0Ha+fM": "","iGB6GJ": "核心网站分析","Tw0saF": "追踪每一个关键指标。通过专为清晰呈现而设计的全面分析,做出数据驱动的决策。","WYPIM3": "高级分析",diff --git a/docs/src/app/[locale]/(home)/compare/components/ComparisonPage.tsx b/docs/src/app/[locale]/(home)/compare/components/ComparisonPage.tsxindex 2289e4687..dea12efe7 100644--- a/docs/src/app/[locale]/(home)/compare/components/ComparisonPage.tsx+++ b/docs/src/app/[locale]/(home)/compare/components/ComparisonPage.tsx@@ -86,7 +86,7 @@ export function ComparisonPage({ competitorName, sections, comparisonContent }:</div><p className="text-neutral-500 dark:text-neutral-400 text-xs md:text-sm flex items-center justify-center gap-2 mt-6"><CheckCircle className="w-3 h-3 md:w-4 md:h-4" />- {t("7-day free trial.")}+ {t("7-day free trial")}</p></div></div>diff --git a/docs/src/app/[locale]/(home)/features/page.tsx b/docs/src/app/[locale]/(home)/features/page.tsxindex 98f357e16..40328c31a 100644--- a/docs/src/app/[locale]/(home)/features/page.tsx+++ b/docs/src/app/[locale]/(home)/features/page.tsx@@ -342,7 +342,7 @@ export default function FeaturesPage() {eventProps={{ location: "features_hero", button_text: "Get started for free" }}className="w-full sm:w-auto bg-emerald-600 hover:bg-emerald-500 text-white font-medium px-6 py-3 rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:ring-opacity-50 cursor-pointer">- {t("Start free trial")}+ {t("Start for $0")}</TrackedButton><TrackedButtonhref="https://demo.rybbit.com/1"@@ -357,7 +357,7 @@ export default function FeaturesPage() {</div><p className="text-neutral-500 dark:text-neutral-400 text-sm flex items-center justify-center gap-2 mt-6"><CheckCircle className="w-4 h-4" />- {t("7-day free trial.")}+ {t("7-day free trial")}</p></div></div>diff --git a/docs/src/app/[locale]/(home)/pricing/components/ComparisonSection.tsx b/docs/src/app/[locale]/(home)/pricing/components/ComparisonSection.tsxindex 05e65e6e4..57798c5b4 100644--- a/docs/src/app/[locale]/(home)/pricing/components/ComparisonSection.tsx+++ b/docs/src/app/[locale]/(home)/pricing/components/ComparisonSection.tsx@@ -315,7 +315,7 @@ export function ComparisonSection({ isAnnual }: { isAnnual: boolean }) {href="https://app.rybbit.io/signup"className="inline-flex items-center justify-center px-4 py-2 bg-emerald-600 hover:bg-emerald-500 text-white text-sm font-medium rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200">- {t("Start free trial")}+ {t("Start for $0")}</AppLink></div><div className="flex flex-col items-center justify-center px-4 border-r border-neutral-400/50 dark:border-neutral-700/50">@@ -327,7 +327,7 @@ export function ComparisonSection({ isAnnual }: { isAnnual: boolean }) {href="https://app.rybbit.io/signup"className="inline-flex items-center justify-center px-4 py-2 bg-emerald-600 hover:bg-emerald-500 text-white text-sm font-medium rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200">- {t("Start free trial")}+ {t("Start for $0")}</AppLink></div><div className="flex flex-col items-center justify-center px-4 border-r border-neutral-400/50 dark:border-neutral-700/50">@@ -339,7 +339,7 @@ export function ComparisonSection({ isAnnual }: { isAnnual: boolean }) {href="https://app.rybbit.io/signup"className="inline-flex items-center justify-center px-4 py-2 bg-emerald-600 hover:bg-emerald-500 text-white text-sm font-medium rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200">- {t("Start free trial")}+ {t("Start for $0")}</AppLink></div><div className="flex flex-col items-center justify-center px-4">diff --git a/docs/src/components/CTASection.tsx b/docs/src/components/CTASection.tsxindex 44fb924ff..352fdb25a 100644--- a/docs/src/components/CTASection.tsx+++ b/docs/src/components/CTASection.tsx@@ -24,7 +24,7 @@ export function CTASection({const t = useExtracted();const resolvedTitle = title ?? t("Ready for better analytics?");const resolvedDescription = description ?? t("Powerful insights without the complexity. Privacy-focused analytics that just works.");- const resolvedPrimaryButtonText = primaryButtonText ?? t("Start free trial");+ const resolvedPrimaryButtonText = primaryButtonText ?? t("Start for $0");const resolvedSecondaryButtonText = secondaryButtonText ?? t("Live demo");return (@@ -83,7 +83,7 @@ export function CTASection({</div><p className="text-neutral-500 text-sm">- {t("7-day free trial.")}+ {t("7-day free trial")}</p></div></div>diff --git a/docs/src/components/HeroSection.tsx b/docs/src/components/HeroSection.tsxindex 7f1f65c30..f9e2ae35a 100644--- a/docs/src/components/HeroSection.tsx+++ b/docs/src/components/HeroSection.tsx@@ -68,7 +68,7 @@ export function HeroSection({eventProps={{ location: "hero", button_text: "get started" }}className="w-full whitespace-nowrap sm:w-auto bg-emerald-600 hover:bg-emerald-500 text-white font-medium px-6 py-3 rounded-lg shadow-lg shadow-emerald-900/20 transform hover:-translate-y-0.5 transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:ring-opacity-50 cursor-pointer">- {t("Start free trial")}+ {t("Start for $0")}</TrackedButton><TrackedButtonhref="https://demo.rybbit.com/81"@@ -81,10 +81,10 @@ export function HeroSection({{t("Live demo")}</TrackedButton></div>- <p className="text-neutral-500 dark:text-neutral-400 text-xs md:text-sm flex items-center justify-center gap-2 mt-6">+ {/* <p className="text-neutral-500 dark:text-neutral-400 text-xs md:text-sm flex items-center justify-center gap-2 mt-6"><CircleCheckIcon size={16} className="text-neutral-500 dark:text-neutral-400" />{t("7-day free trial.")}- </p>+ </p> */}</div><div className="relative w-full max-w-[1300px] mb-10">{/* Background gradients - overlapping circles for organic feel */}diff --git a/docs/src/components/PricingSection.tsx b/docs/src/components/PricingSection.tsxindex a7c33c10b..068ed0ddf 100644--- a/docs/src/components/PricingSection.tsx+++ b/docs/src/components/PricingSection.tsx@@ -243,7 +243,7 @@ export function PricingSection({ isAnnual, setIsAnnual }: { isAnnual: boolean, s</div>)}- buttonText={!isBasicAvailable ? "Up to 250k only" : "Start free trial"}+ buttonText={!isBasicAvailable ? "Up to 250k only" : "Start for $0"}buttonHref={!isBasicAvailable ? undefined : "https://app.rybbit.io/signup"}features={BASIC_FEATURES}disabled={!isBasicAvailable}@@ -267,7 +267,7 @@ export function PricingSection({ isAnnual, setIsAnnual }: { isAnnual: boolean, s</div>)}- buttonText={standardPrices.custom ? "Contact us" : "Start free trial"}+ buttonText={standardPrices.custom ? "Contact us" : "Start for $0"}buttonHref={standardPrices.custom ? "https://www.rybbit.com/contact" : "https://app.rybbit.io/signup"}features={STANDARD_FEATURES}eventLocation={standardPrices.custom ? undefined : "standard"}@@ -289,7 +289,7 @@ export function PricingSection({ isAnnual, setIsAnnual }: { isAnnual: boolean, s</div>)}- buttonText={proPrices.custom ? "Contact us" : "Start free trial"}+ buttonText={proPrices.custom ? "Contact us" : "Start for $0"}buttonHref={proPrices.custom ? "https://www.rybbit.com/contact" : "https://app.rybbit.io/signup"}features={PRO_FEATURES}eventLocation={proPrices.custom ? undefined : "pro"}diff --git a/server/src/api/stripe/createCheckoutSession.ts b/server/src/api/stripe/createCheckoutSession.tsindex f17eae293..99e5c0e0b 100644--- a/server/src/api/stripe/createCheckoutSession.ts+++ b/server/src/api/stripe/createCheckoutSession.ts@@ -7,8 +7,7 @@ import { stripe } from "../../lib/stripe.js";interface CheckoutRequestBody {priceId: string;- successUrl: string;- cancelUrl: string;+ returnUrl: string;organizationId: string;referral?: string;}@@ -17,16 +16,16 @@ export async function createCheckoutSession(request: FastifyRequest<{ Body: CheckoutRequestBody }>,reply: FastifyReply) {- const { priceId, successUrl, cancelUrl, organizationId, referral } = request.body;+ const { priceId, returnUrl, organizationId, referral } = request.body;const userId = request.user?.id;if (!userId) {return reply.status(401).send({ error: "Unauthorized" });}- if (!priceId || !successUrl || !cancelUrl || !organizationId) {+ if (!priceId || !returnUrl || !organizationId) {return reply.status(400).send({- error: "Missing required parameters: priceId, successUrl, cancelUrl, organizationId",+ error: "Missing required parameters: priceId, returnUrl, organizationId",});}@@ -97,6 +96,7 @@ export async function createCheckoutSession(const session = await (stripe as Stripe).checkout.sessions.create({payment_method_types: ["card"],mode: "subscription",+ ui_mode: "embedded",customer: stripeCustomerId,line_items: [{@@ -104,8 +104,7 @@ export async function createCheckoutSession(quantity: 1,},],- success_url: successUrl,- cancel_url: cancelUrl,+ return_url: returnUrl,...(referral && { client_reference_id: referral }),// Store organization ID in metadata for webhook processingmetadata: {@@ -123,8 +122,8 @@ export async function createCheckoutSession(},});- // 6. Return the Checkout Session URL- return reply.send({ checkoutUrl: session.url });+ // 6. Return the client secret for embedded checkout+ return reply.send({ clientSecret: session.client_secret });} catch (error: any) {console.error("Stripe Checkout Session Error:", error);return reply.status(500).send({