π³ Payment Integration with Fidelity Bank API
Client
Website
Β
Β
In this project, I implemented a secure payment system using the Fidelity Bank API to handle online transactions for the e-commerce platform. The goal was to replace manual payment confirmation with an automated, reliable, and verifiable digital payment flow.
The integration was built on a Node.js backend that communicates directly with Fidelity Bankβs payment services. This allowed the system to initialize transactions, redirect users for payment, and verify transaction status in real time.
This ensures a fully automated checkout process without manual intervention.
The payment initialization is handled on the server side to ensure security and prevent exposure of sensitive credentials.
const axios = require("axios");
async function initializePayment(order) {
try {
const response = await axios.post(
"https://api.fidelitybank.com/payment/initiate",
{
amount: order.amount,
email: order.customerEmail,
reference: order.referenceId,
callback_url: "https://yourdomain.com/payment/callback"
},
{
headers: {
Authorization: `Bearer ${process.env.FIDELITY_SECRET_KEY}`
}
}
);
return response.data;
} catch (error) {
console.error("Payment initialization error:", error.message);
}
}
To ensure transaction integrity, I implemented a webhook handler that verifies payment status before updating the system.
app.post("/webhook/fidelity", async (req, res) => {
try {
const event = req.body;
if (event.status === "successful") {
await db.query(
"UPDATE orders SET status = ? WHERE reference = ?",
["paid", event.reference]
);
}
res.sendStatus(200);
} catch (error) {
console.error(error.message);
res.sendStatus(500);
}
});
All payment logic is handled on the backend to prevent exposure of sensitive API credentials.
Every payment is verified before updating order status to avoid fake or failed transaction issues.
Each transaction is assigned a unique reference ID to ensure accurate tracking and prevent duplication.
Implemented fallback logic for failed requests, network issues, and pending payments to maintain system stability.
This integration transformed the platform into a fully automated e-commerce system where payments are securely processed and verified in real time.
It improved:
This project demonstrates my ability to integrate real-world banking APIs into production-grade Node.js systems, ensuring secure financial transactions, automated workflows, and scalable backend architecture.
Your email address will not be published. Required fields are marked *