A NodeJs module for performing transfers from your Paystack account to Nigerian banks
npm install --save paystack-transfer
var PaystackTransfer = require('paystack-transfer')(YOUR_SECRET_KEY)
var allBanks = PaystackTransfer.all_banks;
All methods are promisified but you can also use callback(error, result)
as the last argument(optional) in the method call
A bank object is for example is :
first_bank_of_nigeria: {
"name": "First Bank of Nigeria",
"slug": "first-bank-of-nigeria",
"code": "011",
"longcode": "011151003",
"gateway": "etz"
}
PaystackTransfer.createRecipient(name, description, account_number, bank, metadata)
.then(function(body){
...
})
.catch(function(error){
console.log(error);
});
e.g : notice that you just supply the bank object from the allBanks array
PaystackTransfer.createRecipient("Oluwaleke", "Me", "0221859505", allBanks.guaranty_trust_bank, {})
.then(function (body) {
})
.catch(function (error) {
console.log(error);
})
PaystackTransfer.listRecipients()
.then(function(body){
...
})
.catch(function(error){
console.log(error);
});
PaystackTransfer.initiateSingle(source, reason, amount, recipient)
.then(function(body){
...
})
.catch(function(error){
console.log(error);
});
PaystackTransfer.fetchTransfer(code)
.then(function(body){
...
})
.catch(function(error){
console.log(error);
});
PaystackTransfer.listTransfers()
.then(function(body){
...
})
.catch(function(error){
console.log(error);
});
PaystackTransfer.finalize(transfer_code, otp)
.then(function(body){
...
})
.catch(function(error){
console.log(error);
});
PaystackTransfer.initiateBulk(source, transfers)
.then(function(body){
...
})
.catch(function(error){
console.log(error);
});
PaystackTransfer.checkBalance()
.then(function(body){
...
})
.catch(function(error){
console.log(error);
});
PaystackTransfer.resendOtp(transfer_code)
.then(function(body){
...
})
.catch(function(error){
console.log(error);
});
PaystackTransfer.disableOtp(otp)
.then(function(body){
...
})
.catch(function(error){
console.log(error);
});
PaystackTransfer.finalizeOtpDisable()
.then(function(body){
...
})
.catch(function(error){
console.log(error);
});
PaystackTransfer.enableOtp()
.then(function(body){
...
})
.catch(function(error){
console.log(error);
});
To run tests, add your Paystack test secret key to package.json. (The test line should look something like this: env KEY=sk_test_1as690gfids3ug34fgd0770ds3df88 ./node_modules/.bin/mocha...). Now run:
npm test
If you want to contribute, also update the corresponding test function and make sure it is working.