const response = await fetch(
'https://api.splashpay.co.tz/api/v1/payments/selcompesa',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-KEY': process.env.SPLASHPAY_KEY,
'X-API-SECRET': process.env.SPLASHPAY_SECRET,
'Idempotency-Key': crypto.randomUUID(),
},
body: JSON.stringify({
amount: 200,
currency: 'TZS',
reference: 'INV-3809993j',
phone: '255787123123',
customer_name: 'John Doe',
customer_email: 'johndoe@gmail.com',
}),
}
);
const payment = await response.json();
console.log(payment);