IDN School NodeJS Client
Welcome to the IDN school client NodeJS documentation. This module is designed for schools and universities to integrate InfraDigital payment services directly into existing SIA platforms. You can view code examples in the dark area to the right
For support with integration please contact your IDN representative at any time.
Adding to your project
// Javascript may use the IDN School Client NodeJS module
npm install --save idn_schools_client
//Then in your application require the module
let idn = require('idn_schools_client');
//To initialise the module
idn.init({
user : "USER",
pass : "PASSWORD",
env : "test" //Set as "production" for production
});
Remember to replace
USER
andPASSWORD
with the username and password given to you by IDN Support
You can install the module from NPM under the package name idn_schools_clients.
Uploading Bills
Upload a single Bill
//Define our bill
let bill = {
nis : "1234",
name : "School A",
phone : "081808039547",
email : "ian@infradigital.io",
bill_account : "MANDIRI",
bill_description : "Invoice May",
bill_active_date : "20181001", //YYYYMMDD
bill_expiry_date : "20181001", //YYYYMMDD
bill_due_date : "20180515", //YYYYMMDD
bill_amount : 3000000,
bill_penalty : 300000
}
//Create it
idn.createBill(bill, function(error, result){
if(error) console.log(error);
else console.log(result);
});
In order to create a bill we can use the handy create function. This function will automatically add the bill to the correct student if the NIS given allready exists, or create a student to associate with the bill if not.
API Call
idn.createBill(bill, callback)
BILL Object
Parameter | Mandetory | Description |
---|---|---|
nis | true | Student NIS |
name | true | Student Name |
phone | false | Student Phone Number |
false | Student Email Address | |
bill_account | true | Account Code (destination of funds) |
bill_description | true | A description of the bill, eg "SPP Bulan Mei" |
bill_expiry_date | true | Student Name |
bill_due_date | true | Student Name |
bill_active_date | false | The date upon which this bill becomes active |
bill_amount | true | The amount of the bill in rupiah |
bill_penalty | false | The penalty applied if the bill is paid after the due date |
Querying a Students Bills
Query all bills
let nis = "1234";
idn.getStudentBills(nis, function(error, result){
if(error) console.log(error);
else console.log(result);
});
//Response is an array of bills
[ { biller_name: 'SD Taman Ilmu',
biller_code: '10014',
merchant_name: null,
merchant_code: null,
bill_name: 'Wulandari Sulistyo',
bill_key: '60001005',
bill_description: null,
phone: '0081808039547',
email: 'ian@infradigital.io',
state: 'deleted',
bill_component_id: 'bf12614e-6930-4c09-8b70-31864211a0e1',
bill_component_name: 'SPP',
bill_ref_number: null,
bill_date: '2017-11-28T08:23:00.244633Z',
due_date: '2017-12-20T00:00:00Z',
expiry_date: '2017-12-20T00:00:00Z',
payment_date: null,
active_date: null,
amount: 455000,
penalty_amount: null,
amount_paid: null,
amount_currency: 'IDR',
admin_fee: null,
merchant_ref_number: null,
notes: null,
batch_id: 'ian@infradigital.io | 28 11 2017 01:11',
biller_account_name: null,
biller_account_code: null,
biller_bank_name: null,
biller_bank_account_number: null,
biller_bank_account_code: null,
last_updated: '2018-01-18T01:00:00.060343Z' } ... ] }
This function returns the array of bills associated with the student. It includes bills that are PAID, PROVISIONED (unpaid) & EXPIRED.
API Call
idn.getStudentBills(nis, callback)
Query PAID bills
let nis = "1234";
idn.getStudentPaidBills(nis, function(error, result){
if(error) console.log(error);
else console.log(result);
});
//Response is an array of bills
[ { biller_name: 'SD Taman Ilmu',
biller_code: '10014',
merchant_name: null,
....
biller_bank_account_code: null,
last_updated: '2018-01-18T01:00:00.060343Z' } ... ] }
This function returns the array of bills associated with the student. It only includes bills that are PAID.
API Call
idn.getStudentPaidBills(nis, callback)
Query UNPAID bills
let nis = "1234";
idn.getStudentUnpaidBills(nis, function(error, result){
if(error) console.log(error);
else console.log(result);
});
//Response is an array of bills
[ { biller_name: 'SD Taman Ilmu',
biller_code: '10014',
merchant_name: null,
....
biller_bank_account_code: null,
last_updated: '2018-01-18T01:00:00.060343Z' } ... ] }
This function returns the array of bills associated with the student. It only includes bills that are UNPAID.
API Call
idn.getStudentUnpaidBills(nis, callback)
Query EXPIRED bills
let nis = "1234";
idn.getStudentExpiredBills(nis, function(error, result){
if(error) console.log(error);
else console.log(result);
});
//Response is an array of bills
[ { biller_name: 'SD Taman Ilmu',
biller_code: '10014',
merchant_name: null,
....
biller_bank_account_code: null,
last_updated: '2018-01-18T01:00:00.060343Z' } ... ] }
This function returns the array of bills associated with the student. It only includes bills that are EXPIRED, ie expired without being paid.
API Call
idn.getStudentExpiredBills(nis, callback)
Querying a Schools Bills
Query all bills
idn.getAllBills(function(error, result){
if(error) console.log(error);
else console.log(result);
});
//Response is an array of bills
[ { biller_name: 'SD Taman Ilmu',
biller_code: '10014',
merchant_name: null,
....
biller_bank_account_code: null,
last_updated: '2018-01-18T01:00:00.060343Z' } ... ] }
This function returns the array of bills within a school.
API Call
idn.getAllBills(callback)
Query all PAID bills
idn.getAllPaidBills(function(error, result){
if(error) console.log(error);
else console.log(result);
});
//Response is an array of bills
[ { biller_name: 'SD Taman Ilmu',
biller_code: '10014',
merchant_name: null,
....
biller_bank_account_code: null,
last_updated: '2018-01-18T01:00:00.060343Z' } ... ] }
This function returns the array of PAID bills within a school.
API Call
idn.getAllPaidBills(callback)
Query PAID bills by Date
let date = "20180222" //Format YYYYMMDD
idn.getAllPaidBillsByDate(date, function(error, result){
if(error) console.log(error);
else console.log(result);
});
//Response is an array of bills
[ { biller_name: 'SD Taman Ilmu',
biller_code: '10014',
merchant_name: null,
....
biller_bank_account_code: null,
last_updated: '2018-01-18T01:00:00.060343Z' } ... ] }
This function returns the array of PAID bills within a school for that particular date.
API Call
idn.getAllPaidBillsByDate(date, callback)
Query all UNPAID bills
idn.getAllOutstandingBills(function(error, result){
if(error) console.log(error);
else console.log(result);
});
//Response is an array of bills
[ { biller_name: 'SD Taman Ilmu',
biller_code: '10014',
merchant_name: null,
....
biller_bank_account_code: null,
last_updated: '2018-01-18T01:00:00.060343Z' } ... ] }
This function returns the array of UNPAID bills within a school.
API Call
idn.getAllOutstandingBills(callback)
Query UNPAID bills by Date
let date = "20180222" //Format YYYYMMDD
idn.getAllOutstandingBillsByDate(date, function(error, result){
if(error) console.log(error);
else console.log(result);
});
//Response is an array of bills
[ { biller_name: 'SD Taman Ilmu',
biller_code: '10014',
merchant_name: null,
....
biller_bank_account_code: null,
last_updated: '2018-01-18T01:00:00.060343Z' } ... ] }
This function returns the array of UNPAID (provisioned) bills within a school.
API Call
idn.getAllOutstandingBillsByDate(date, callback)
Searching Bills
Search bills
let data = {
state: "paid",
limit: "100",
offset: "50"
}
idn.searchBills(date, function(error, result){
if(error) console.log(error);
else console.log(result);
});
//Response is an array of bills
[ { biller_name: 'SD Taman Ilmu',
biller_code: '10014',
merchant_name: null,
....
biller_bank_account_code: null,
last_updated: '2018-01-18T01:00:00.060343Z' } ... ] }
This function allows you to make complex searches on bills within a school using a number of variables.
API Call
idn.searchBills(data, callback)
Students
Get Student by NIS
let nis = "1234"
idn.getStudent(nis, function(error, result){
if(error) console.log(error);
else console.log(result);
});
//Response is student object
{ name: 'School A',
bill_key_name: null,
bill_key_value: '1234',
phone: '081808039547',
email: 'ian@infradigital.io',
description: '' }
This function allows you to query a student by NIS.
API Call
idn.getStudent(data, callback)
Get all Students
let nis = "1234"
idn.getAllStudents(function(error, result){
if(error) console.log(error);
else console.log(result);
});
//Response is an array of student objects
[
{ name: 'School A',
bill_key_name: null,
bill_key_value: '1234',
phone: '081808039547',
email: 'ian@infradigital.io',
description: '' }
...
]
This function allows you to query a student by NIS.
API Call
idn.getStudent(data, callback)
Data Options
Parameter | Mandetory | Description |
---|---|---|
bill_key | false | Student NIS |
state | false | "provisioned", "expired" or "paid" |
account_code | false | Account Code (destination of funds) |
start_payment_date | false | Bills that were paid after this date (YYYYMMDD) |
end_payment_date | false | Bills that were paid before this date (YYYYMMDD) |
start_due_date | false | Bills that are due after this date (YYYYMMDD) |
end_due_date | false | Bills that are due before this date (YYYYMMDD) |
offset | false | Offset of results (for pagination) |
limit | false | Limit on number of results, default = 50 |
Status Codes
The following status codes may be encountered
Status Code | Meaning |
---|---|
200 | Succesfully Requested |
201 | Succesfully Created |
400 | Bad Request |
401 | Unauthorized -- Please check your authorisation |
403 | Forbidden -- Please check your authorisation |
404 | Not Found -- The specified kitten could not be found |
406 | Not Acceptable -- Please check your JSON format |
500 | Internal Server Error -- Please contact IDN Support |
503 | Service Unavailable -- Please contact IDN Support |