Kuda Node.js Library
NodeJS wrapper for making secure request to Kuda API
Getting started
- paste your private and public key (both in XML format) in your project directory
- Your client key is the name of your private key file
Using the library
run npm install kuda-node
Library setup
const fs = require("fs");
const Kuda = require('kuda-node');
const publicKey = fs.readFileSync("./kuda.public.xml");
const privateKey = fs.readFileSync("./path-to-private-key.xml");
const clientKey = "name-of-private-key-file";
const kuda = Kuda({
publicKey,
privateKey,
clientKey
});
Making a request
kuda({
serviceType: "SERVICE_TYPE",
requestRef: "requestReference",
data: {
param: value
}
});
Sample request
const shortid = require("shortid");
kuda(
{
serviceType: "CREATE_VIRTUAL_ACCOUNT",
requestRef: Math.floor(Math.random() * 1000000000000 + 1),
data: {
email: "ajala@obi.com",
phoneNumber: "08012345678",
firstName: "Ajala",
lastName: "Obi",
trackingReference: "vAcc-" + shortid.generate()
}
},
data => {
console.log(JSON.stringify(data, null, 2));
}
);
const onboardUser = async(email, phoneNumber, firstName, lastName, trackingReference) => {
const response = await kuda({
serviceType: 'CREATE_VIRTUAL_ACCOUNT',
requestRef: Number,
data: { email, phoneNumber, firstName, lastName, trackingReference }
})
}
Refer to documentation for respective data types for each fields in the payload
Contribution & Issues
- Simply fork the repo, make changes and make a pull request
- You can open an issue for support or suggestions
Authors
Acknowledgements