diff --git a/src/api/checkoutClient.ts b/src/api/checkoutClient.ts index cfdd652..4a83b55 100644 --- a/src/api/checkoutClient.ts +++ b/src/api/checkoutClient.ts @@ -1,7 +1,18 @@ import axios from 'axios'; import { logger } from '../utils/logger'; -const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:3001'; +// Get API base URL from runtime config (window.env) or build-time config +const getApiBaseUrl = (): string => { + // Check window.env first (runtime config from env.sh) + if (typeof window !== 'undefined' && window.env?.API_BASE_URL) { + return window.env.API_BASE_URL; + } + + // Fall back to build-time env or default + return import.meta.env.VITE_API_BASE_URL || 'http://localhost:3001'; +}; + +const API_BASE_URL = getApiBaseUrl(); export interface CreateCheckoutSessionParams { tons: number;