b2c-billers-nodejs
This repository contains Java SDK and samples for Business to Consumer bill payments.
Prerequisites
- Nodejs Runtime.
- An environment which supports TLS 1.2
- Interswitch Base Library Click here
Welcome
Read our FAQs here
Biller
A biller is any Organization/Institution/Business that is able to exchange services for a fee. e.g Telecoms provider(Airtel, Glo, MTN), Government Body(Lagos State) etc.
Category
Billers are grouped under categories. For instance, all cable providers(DSTV, GOTV) can e grouped under a cable
Category.
Customer
An individual that has an intent and/or pays for any of the services offered by a Biller.
PaymentItem
A biller(e.g DSTV) can offer different services and hence different prices for them. Each of those services, falls under a payment-item and has a unique payment-item-code. We say that a user has intent to pay for a payment-item offered by a Biller. An example of a payment-item under DSTV is the DSTV Premium Bouquet
What this SDK provides for you
Get All Billers
1 2 |
Get a list of all billers supported on our platform. |
Get All Categorys
1 2 |
Get a list of all categorys and associated billers supported on our platform. |
Get All Billers under a Category
1 2 |
Get a list of all biilers under a particular category. |
Get Biller Payment Items
1 2 |
Get a list of all payment-items under aparticular Biller. |
Validate Customer
1 2 |
Validates a customer-id under a particular biller. |
Make payment for a customer
1 2 |
Makes a payment for a payment-item for a particular customer. |
Query the status of a transaction
1 2 |
Query the status of a transaction made in the past based on the Request Reference |
Quick start
npm
1 2 |
npm install interswitch |
Samples
Check out the samples folder for sample code on all the features above.
Support Team
Still experiencing issues, quickly talk to our Engineers at Support chat or Support chat and get your issues fixed in a giffy.
B2C-Funds-Transfer-nodejs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
/** * * sample code to showcase all the request in transfer service. * * For any difficulty, contact any of the contributors for help. * */ var app = require('./src/index.js'); /** * Initiating entity code: * This is unique to a each merchant. * When you are ready to move to production, * you will be provided with your initiatingEntityCode */ var initiatingEntityCode = "XXT"; /** * @clientId: * @clientSecret: * These are for test environment. * var clientId = "IKIA2EFBE1EF63D1BBE2AF6E59100B98E1D3043F477A"; * var clientSecret = "uAk0Amg6NQwQPcnb9BTJzxvMS6Vz22octQglQ1rfrMA="; * var transfer = new FundTransfer({clientId: clientId, clientSecret: clientSecret, environment: "SANDBOX"}) */ /** * @clientId: * @clientSecret: * These are for the sandbox environment. */ var clientId = "IKIA6570778A3484D6F33BC7E4165ADCA6CF06B2860A"; var clientSecret = "DXfUwpuIvMAKN84kv38uspqGOsStgFS0oZMjU7bPwpU="; var Interswitch = require('interswitch'); var TransferRequestBuilder = app.TransferRequestBuilder; var FundTransfer = app.FundTransfer; var Constant = app.Constant; /** * Create a funds transfer object. * e.g FundsTransfer transfer = new FundsTransfer({clientId: clientId, clientSecret: clientSecret, environment: "SANDBOX"}); * * With this object you can * * 1. Get all supported banks on our platform. * * e.g var bankResponse = transfer.fetchBanks(); * * If successful, it returns a list of all banks. Otherwise it * throws returns an error object or throws an exception. * * 2. Account Validation * * e.g var validationResponse = transfer.validateAccount(request);// validate account * * This is used to validate an account number against a source bank. * If successful, you know for sure the bank account number is valid. * Otherwise, it is probably okay to still go on with the transaction. * * 3. Funds Transfer. * * e.g var response = transfer.send(request); // send transfer request * * This api, is used to initiate a funds transfer from a sender to a receiver. * The sample code is clear and concise and states the mandatory and optional fields. * * * */ var transfer = new FundTransfer({clientId: clientId, clientSecret: clientSecret, environment: "SANDBOX"}); //var transfer = new FundTransfer({clientId: clientId, clientSecret: clientSecret, environment: "PRODUCTION"}); //var transfer = new FundTransfer({clientId: clientId, clientSecret: clientSecret}); transfer.fetchBanks(function(err, response){ if(err) { //fetch banks was not successful return; } else { console.log("bank response "+JSON.stringify(response.body)); if(bankResponse) { var bankResponse = JSON.parse(response.body).banks; var aBank = bankResponse[0]; var cbnCode = aBank.cbnCode; // Central bank code var bankName = aBank.bankName; // bank name: var bankCode = aBank.bankCode; // bankcode in alphabetical form: UBA, GTB, FBN console.log(cbnCode+" "+bankName+" "+bankCode); } var request = new TransferRequestBuilder(initiatingEntityCode) .amount("100000") // mandatory, minor denomination .channel(Constant.LOCATION) // mandatory: ATM-1, POS-2, WEB-3, MOBILE-4, KIOSK-5, PCPOS-6, LOCATION-7, DIRECT DEBIT-8 .destinationBankCode(cbnCode)/* mandatory: To be gotten from the get all banks code (transfer.fetchBanks())*/ .toAccountNumber("0114951936") // mandatory .requestRef("60360575603527")// mandatory .senderPhoneNumber("07036913492") // optional .senderEmail("grandeur_man@yahoo.com") // optional .senderLastName("Desmond") // optional .senderOtherNames("Samuel") // optional .receiverPhoneNumber("07036913492") // optional .receiverEmail("grandeur_man@yahoo.com") // optional .receiverLastName("Desmond") // optional .receiverOtherNames("Samuel") // optional .fee("10000")// optional (minor denomination) .build(); var validationResponse = transfer.validateAccount(request, function(err, name){ if(err) { //name validation was not successful } else { var accountName = name; console.log("account name "+name); } });// validate account var response = transfer.send(request, function(err, response){ if(err) { //an error occured wihle doing transfer console.log(err); } else { if(! response.errors) { var mac = response.mac; var transactionDate = response.transactionDate; var responseCode = response.responseCode; console.log(mac+" "+transactionDate+" "+responseCode); } else { //transfer not successful console.log(JSON.stringify(response)); } } }); } });//end of fetchBanks |
Installation
1 |
$ npm install interswitch-funds-transfer |
Features
- Get All Supported Banks
- Account Validation
- Funds Transfer
Running sample app
1 2 3 |
cd B2C-Funds-Transfer-nodejs node AppDriver.js |