diff --git a/backend/services/billing.py b/backend/services/billing.py index 74076745..0379af65 100644 --- a/backend/services/billing.py +++ b/backend/services/billing.py @@ -14,6 +14,8 @@ from services.supabase import DBConnection from utils.auth_utils import get_current_user_id_from_jwt from pydantic import BaseModel from utils.constants import MODEL_ACCESS_TIERS, MODEL_NAME_ALIASES +import os + # Initialize Stripe stripe.api_key = config.STRIPE_SECRET_KEY @@ -37,6 +39,7 @@ class CreateCheckoutSessionRequest(BaseModel): price_id: str success_url: str cancel_url: str + tolt_referral: Optional[str] = None class CreatePortalSessionRequest(BaseModel): return_url: str @@ -542,7 +545,6 @@ async def create_checkout_session( logger.exception(f"Error updating subscription {existing_subscription.get('id') if existing_subscription else 'N/A'}: {str(e)}") raise HTTPException(status_code=500, detail=f"Error updating subscription: {str(e)}") else: - # --- Create New Subscription via Checkout Session --- session = stripe.checkout.Session.create( customer=customer_id, payment_method_types=['card'], @@ -552,7 +554,8 @@ async def create_checkout_session( cancel_url=request.cancel_url, metadata={ 'user_id': current_user_id, - 'product_id': product_id + 'product_id': product_id, + 'tolt_referral': request.tolt_referral }, allow_promotion_codes=True ) diff --git a/frontend/src/app/(dashboard)/(personalAccount)/settings/layout.tsx b/frontend/src/app/(dashboard)/(personalAccount)/settings/layout.tsx index 57ee21db..52c81f4d 100644 --- a/frontend/src/app/(dashboard)/(personalAccount)/settings/layout.tsx +++ b/frontend/src/app/(dashboard)/(personalAccount)/settings/layout.tsx @@ -3,6 +3,7 @@ import { Separator } from '@/components/ui/separator'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; +import Script from 'next/script'; export default function PersonalAccountSettingsPage({ children, @@ -16,30 +17,30 @@ export default function PersonalAccountSettingsPage({ { name: 'Billing', href: '/settings/billing' }, ]; return ( -
- -
- -
- {children} + <> +
+ +
+ +
+ {children} +
-
+ ); } diff --git a/frontend/src/app/layout.tsx b/frontend/src/app/layout.tsx index 677b1f05..16734734 100644 --- a/frontend/src/app/layout.tsx +++ b/frontend/src/app/layout.tsx @@ -123,13 +123,12 @@ export default function RootLayout({ 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-PCHSN4M2');`} - {/* End Google Tag Manager */} + - {/* Google Tag Manager (noscript) */}