DEV Community

Caleb Nkunze
Caleb Nkunze

Posted on • Originally published at blog.devgenius.io on

How I built a Payment Gateway using Javascript.


Photo by Pankaj Patel on Unsplash

After my University studies (about 5 years back), I had a desire to build a project not only to generate income, but to enable other people and teams generate and manage their income as well.

Despite my studies Information Technology, I had acquired little knowledge in JAVA and C/C++ languages and could hardly create any application using any of them yet they are amazing development languages. I ventured out in to easy-to-learn languages like Javascript, Python and PHP (Yess… I know what is running through your mind, but PHP seemed way easy for me). I was able to use their respective frameworks in different working environments like NodeJS and VueJS (for Javascript), Django (for Python) and CodeIgniter, Symfony, Laravel (for PHP).

The project

Finally, the time came for me to get back on course of creating my own project. I had thinking sessions and research for problems I could solve. I decided to look first into the challenges faced in generating and managing income in my country and region Uganda (East Africa), thus coming up with an idea of developing a simple yet robust payment platform to serve individuals, companies/organisations and other developers to integrate the available payment methods (Mobile Money and Card payments) in to their day to day transactions activities.

The platform was to have the Gateway which would communicate directly with the Third-Party service providers like mobile money networks, the api (backend) which will serve the frontend and also help developers integrate the platform’s functionalities into their own apps and a user interface for users to manage their transactions (Wallet) and carry out other payments like top up airtime, data bundles and so on. And later a mobile app to complement the web app.

The structure

When it came to choosing the language and/or framework to use, I decided to go for Javascript. This is because out of all the languages, I wanted to use one that I have better experience with and can provide me with capabilities to create the front and backend with one language since it was a one-man team for the start.

The Gateway

The gateway uses NodeJS, and with it’s single-thread model and good performance, I believe that this will provide a good start off as monitoring is being done to see if we need changes as users and request increase. The database of choice is MongoDB which provides fast read and write capabilities to log transaction statuses which will be used to update the the api part of the project. This will store the data for a short period of time using the TTL collection feature of MongoDB, and most or all the data will be stored by the API.

The API

The API also uses NodeJS as well and the database of choice was Postgres over MySQL because of it’s provision of a variety of datatypes as I will be using unique datatypes from the basic character and numeric datatypes, and it’s effective ability to easily expand into enterprise level with complex queries and frequent write operations. The API will be able to serve the Dashboard (WebApp/frontend), the developer API and the Mobile App.

There are a number of NodeJS api boilerplate projects that you can take advantage of to quick start your development, below are some of the ones I took inspiration from:

The Frontend (Dashboard)

The dashboard will enable the users to collect, self-deposit and withdraw money, check their balances, and carry out other transactions like top up data bundles. This will use VueJS framework and NuxtJS for the User Interfaces and handling notifications and alerts for the different activities done by the user.

I will be sharing more in the next post the breakdown of the above 3 components of this projects for example the authentication, authorisation, request, response and error handling among others.

Thanks for the read.

More NodeJS api boiler plate projects:

GitHub - kunalkapadia/express-mongoose-es6-rest-api: A boilerplate application for building RESTful APIs Microservice in Node.js using express and mongoose in ES6 with code coverage and JsonWebToken Authentication


Top comments (0)