-
Register in API through Portal https://paytonight.herokuapp.com/
-
Login and generate API credentials, make sure to save APP_KEY or you will need to generate another one (notice that APP ID doesn't change so)
-
Make a POST Call to /api/payment/checkout with the following headers:
Content-Type: 'application/json',
x-api-key: "<your API key>"
and the following body:
APP_ID:"<Your APP_ID>"
amount: <Amount charged>
-
The page will be redirected to
/api/payment/iframe?token=token
with the following iframe -
Enter payment card credentials
-
A response should return if payment credentials were accepted by bank.
Example API request would be
const PAYMENT_ENDPOINT = "https://paytonight.herokuapp.com/api/payment/checkout";
const body = JSON.stringify({
APP_ID: "APP_ID",
amount: amount,
});
const options = {
method: "POST",
headers: {
"x-api-key": "APP_KEY",
"Content-Type": "application/json",
},
body,
};
fetch(PAYMENT_ENDPOINT, options)
.then((response) => {
if (response.redirected) {
window.location.href = response.url;
}
})
.catch(function (err) {
console.info(err + " url: " + url);
});
- Make a POST request to /auth/register with the following body:
username:"<username>"
password:"<password>"
email:"<email>"
organization:"<organization>"
- Make a POST request to /auth/login with the following body:
username:"<username>"
password:"<password>"
After successful login you should be able to view the dashboard and make the call to the payment gateway
- create .env file with the following attributes:
DATABASE_URL= # Path to mongoDB
PORT= # Port which the app runs
SESSION_SECRET= # Secret key for session.
JWT_ACCESS_TOKEN_SECRET= # json webtoken secret
JWT_REFRESH_TOKEN_SECRET=#
PAYMENT_GATEWAY_ID= # An ID supplied by banking app
BANK_ENDPOINT= # A banking endpoint used for transactions
BANK_USERNAME= # A username supplied by banking app
BANK_PASSWORD= # A password supplied by banking app
PAYMENT_ENDPOINT= # This app's deployment url
-
run
npm install
-
run
node server.js
- run
npm run dev