// src/services/cinetpay.ts import axios from 'axios'; import dotenv from 'dotenv'; dotenv.config(); const baseURL = process.env.CINETPAY_BASE_URL || 'https://api-checkout.cinetpay.com/v2'; const api = axios.create({ baseURL, headers: { 'Content-Type': 'application/json' }, }); export async function initiatePayment(data: { amount: number; currency: string; transaction_id: string; description: string; customer_name: string; customer_surname: string; customer_email: string; customer_phone_number: string; notify_url: string; return_url: string; }) { const response = await api.post('/payment', { apikey: process.env.CINETPAY_API_KEY, site_id: process.env.CINETPAY_SITE_ID, ...data, channels: 'ALL', lang: 'fr', }); return response.data; }