import {ok, badRequest, serverError} from 'wix-http-functions'; import {fetch} from 'wix-fetch'; export async function createPaystackTransaction(amount, currency, donorName, donorEmail) { const paystackSecretKey = 'YOUR_PAYSTACK_SECRET_KEY'; // Replace with your Paystack secret key try { const response = await fetch('https://api.paystack.co/transaction/initialize', { method: 'post', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${paystackSecretKey}` }, body: JSON.stringify({ amount: amount, currency: currency, email: donorEmail, metadata: { custom_fields: [ { display_name: "Donor Name", variable_name: "donor_name", value: donorName } ] } }) }); if (!response.ok) { return badRequest('Failed to create transaction'); } const transactionData = await response.json(); return ok(transactionData.data); } catch (error) { return serverError('Server error:', error.message); } }
top of page

EVERY ACT OF KINDNESS COUNTS

Join us in our mission to tranform lives and build a brighter future

MAKE A DONATION

Donating to a community is a great way to give back and support its environment and residents. and this makes a real difference. Consider making a donation today and help support the community.

Thanks for submitting!

TRUE Foundation logo

True Educational Foundation

Knowledge is Power!

Education is the Key!

Contact us

​20 Adelabu Street, Surulele Lagos

234-802-312-0716

  • Instagram
  • Facebook
  • X
  • LinkedIn

Keep in Touch

Thank you for subscribing!

bottom of page