requireLogin(); // Prüfe ob Billing aktiviert if (!$settingsManager->isBillingEnabled()) { header('Location: /dashboard/'); exit; } $user = $auth->getUser(); $tenantId = $user['tenant_id'] ?? 0; $flashMessage = null; $flashType = 'info'; $stripe = new StripeService(); $subscriptions = new SubscriptionManager(); // Aktuelle Subscription $currentSub = null; $plans = []; $invoices = []; $trialDays = 0; try { $currentSub = $subscriptions->getSubscription($tenantId); $plans = $subscriptions->getPlans(); $invoices = $subscriptions->getInvoices($tenantId, 5); $trialDays = $subscriptions->getTrialDaysRemaining($tenantId); } catch (\Exception $e) { $flashMessage = 'Fehler beim Laden der Abrechnungsdaten'; $flashType = 'error'; } // Checkout starten if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['plan_id'])) { $planId = (int)$_POST['plan_id']; $plan = $subscriptions->getPlan($planId); if ($plan && !empty($plan['stripe_price_id'])) { $baseUrl = (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; $session = $stripe->createCheckoutSession( $tenantId, $plan['stripe_price_id'], $baseUrl . '/dashboard/billing.php?success=1', $baseUrl . '/dashboard/billing.php?canceled=1' ); if ($session && isset($session['url'])) { header('Location: ' . $session['url']); exit; } else { $flashMessage = 'Fehler beim Erstellen der Checkout-Session'; $flashType = 'error'; } } } // Billing Portal öffnen if (isset($_GET['portal'])) { $baseUrl = (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; $session = $stripe->createPortalSession($tenantId, $baseUrl . '/dashboard/billing.php'); if ($session && isset($session['url'])) { header('Location: ' . $session['url']); exit; } } // Success/Cancel Messages if (isset($_GET['success'])) { $flashMessage = 'Zahlung erfolgreich! Ihr Abo ist jetzt aktiv.'; $flashType = 'success'; } if (isset($_GET['canceled'])) { $flashMessage = 'Checkout abgebrochen.'; $flashType = 'warning'; } $pageTitle = 'Abrechnung'; $currentPage = 'billing'; ob_start(); ?>

Aktueller Plan

0): ?>

Trial endet in Tag

Nächste Abrechnung:

isConfigured() && !empty($currentSub['stripe_customer_id'])): ?> Abo verwalten

Enthaltene Features:

$value): ?> 'Max. Zuschauer: ' . ($value === -1 ? '∞' : $value), 'storage_gb' => 'Speicher: ' . $value . ' GB', 'custom_domain' => 'Custom Domain', 'weather_widget' => 'Wetter-Widget', 'timelapse' => 'Timelapse', 'analytics' => 'Analytics', 'branding' => 'Custom Branding', 'priority_support' => 'Priority Support', ]; echo $labels[$feature] ?? ucfirst(str_replace('_', ' ', $feature)); ?>

Kein aktives Abo

Verfügbare Pläne

0): ?> CHF /Monat Kostenlos
    $value): ?>
  • 'Bis ' . ($value === -1 ? 'unbegrenzt' : $value) . ' Zuschauer', 'storage_gb' => $value . ' GB Speicher', 'custom_domain' => 'Eigene Domain', 'weather_widget' => 'Wetter-Widget', 'timelapse' => 'Timelapse', 'analytics' => 'Analytics', 'branding' => 'Custom Branding', 'priority_support' => 'Priority Support', ]; echo $labels[$feature] ?? ucfirst(str_replace('_', ' ', $feature)); ?>
0 && $stripe->isConfigured()): ?>

Rechnungen

Datum Betrag Status PDF
Download
isConfigured()): ?>
Hinweis: Stripe ist noch nicht konfiguriert. Bitte fügen Sie Ihre Stripe API-Keys in config.php hinzu.