// Get Helcim payment plans const HELCIM_API_BASE = 'https://api.helcim.com/v2' export default defineEventHandler(async (event) => { try { const config = useRuntimeConfig(event) const helcimToken = config.public.helcimToken || process.env.NUXT_PUBLIC_HELCIM_TOKEN console.log('Fetching payment plans from Helcim...') const response = await fetch(`${HELCIM_API_BASE}/payment-plans`, { method: 'GET', headers: { 'accept': 'application/json', 'api-token': helcimToken } }) if (!response.ok) { console.error('Failed to fetch payment plans:', response.status, response.statusText) const errorText = await response.text() console.error('Response body:', errorText) throw createError({ statusCode: response.status, statusMessage: `Failed to fetch payment plans: ${errorText}` }) } const plansData = await response.json() console.log('Payment plans retrieved:', JSON.stringify(plansData, null, 2)) return { success: true, plans: plansData } } catch (error) { console.error('Error fetching Helcim payment plans:', error) throw createError({ statusCode: error.statusCode || 500, statusMessage: error.message || 'Failed to fetch payment plans' }) } })