BACK
NAV undefined
undefined
bash php

Introduction

Welcome to the IDN client API documentation. These APIs are designed for schools to integrate InfraDigital payment services directly into existing SIA platforms

We have language bindings in Curl and PHP. You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

Authentication

To authorize, use this code:

$password = '123';
$password = hash('sha256',  hash('sha256', $password) . date('Ymd'));
$password = '123';
$password = hash('sha256',  hash('sha256', $password) . date('Ymd'));

Please use the username and password provided by IDN for these calls.

The client APIs require your username and password, given by the IDN team. Note, your password will vary between testbed and production environments.

Each API call uses basic HTTP authentication with the username set as your own and the password generated according to the following code:

password = SHA256(SHA256(password) + current_date);

Students

Create Students

Before we create bills we must first create a student to associate them with. This method accepts an array of one or more students to create.

 {
  "bill_list":[
    {
      "name":"Dela 1",
      "bill_key_value":"0001",
      "bill_key_name":"NIS",
      "phone":"085611",
      "email":"mawar@sekolah.com"
    },
    {
      "name":"Erwin",
      "bill_key_value":"0002",
      "bill_key_name":"NIS",
      "phone":"085622",
      "email":"mawar@sekolah.com"
    }
  ]
}
$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{
  "bill_list":[
    {
      "name":"Dela 1",
      "bill_key_value":"0001",
      "bill_key_name":"NIS",
      "phone":"085611",
      "email":"mawar@sekolah.com"
    },
    {
      "name":"Dela 2",
      "bill_key_value":"0002",
      "bill_key_name":"NIS",
      "phone":"085622",
      "email":"mawar@sekolah.com"
    }
  ]
}');

$request->setRequestUrl('https://testclient.infradigital.io/bill/batch');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic MDAwMDE6MGMyYjJlYWE0N2RlNmJjYjE0NGQ4M2VhNWQ2ODMzZjQ2ZWViNGZkY2ZiOGI3NTJiYWRiYTRiOTFmYjRlNTZjMw==',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

The above command returns a 201 response on success

HTTP Request

POST https://testclient.infradigital.io/bill/batch

Query Parameters

Parameter Mandatory Description
name true Student Name
bill_key_value true Students Nomor Induk Siswa
bill_key_name true The identifier of the student, you can use "NIS"
phone false Students phone number (recommended)
email false Students email

Get a Student by NIS

This allows you to query a student by NIS

Remember to replace {NIS} with the NIS of the student you wish to get

GET https://biller:pwd@testclient.infradigital.io/bill/0001
$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://testclient.infradigital.io/bill/0001');
$request->setRequestMethod('GET');
$request->setHeaders(array(
  'authorization' => 'Basic MDAwMDI6MGMyYjJlYWE0N2RlNmJjYjE0NGQ4M2VhNWQ2ODMzZjQ2ZWViNGZkY2ZiOGI3NTJiYWRiYTRiOTFmYjRlNTZjMw=='
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

The above command returns a student object

{
  "name":"Dela 1",
  "bill_key_value":"0001",
  "bill_key_name":"NIS",
  "phone":"085611",
  "email":"mawar@sekolah.com"
}
{
  "name":"Dela 1",
  "bill_key_value":"0001",
  "bill_key_name":"NIS",
  "phone":"085611",
  "email":"mawar@sekolah.com"
}

HTTP Request

GET https://testclient.infradigital.io/bill/{NIS}

Update a Student

This allows you to update a students details

 {
  "name":"Dela",
  "bill_key_value":"001",
  "bill_key_name":"Nomor Induk Siswa",
  "phone":"0856123",
  "email":"mawar@sekolah.com",
  "description":"desc"
}
$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{
  "name":"Dela",
  "bill_key_value":"001",
  "bill_key_name":"Nomor Induk Siswa",
  "phone":"0856123",
  "email":"mawar@sekolah.com",
  "description":"desc"
}');

$request->setRequestUrl('https://testclient.infradigital.io/bill');
$request->setRequestMethod('PUT');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic MDAwMDE6MGMyYjJlYWE0N2RlNmJjYjE0NGQ4M2VhNWQ2ODMzZjQ2ZWViNGZkY2ZiOGI3NTJiYWRiYTRiOTFmYjRlNTZjMw==',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

The above command returns a 200 response on success

HTTP Request

PUT https://testclient.infradigital.io/bill

Query Parameters

Parameter Mandatory Description
name true Student Name
bill_key_value true Students Nomor Induk Siswa
bill_key_name true The identifier of the student, you can use "NIS"
phone false Students phone number (recommended)
email false Students email

Delete a Student

This enables you to delete a student

DEL https://biller:pwd@testclient.infradigital.io/bill/{NIS}
$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://testclient.infradigital.io/bill/0001');
$request->setRequestMethod('DELETE');
$request->setHeaders(array(
  'authorization' => 'Basic MDAwMDE6MGMyYjJlYWE0N2RlNmJjYjE0NGQ4M2VhNWQ2ODMzZjQ2ZWViNGZkY2ZiOGI3NTJiYWRiYTRiOTFmYjRlNTZjMw=='
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

Remember to replace STUDENT with the NIS of the student you wish to delete

HTTP Request

DEL https://testclient.infradigital.io/bill/{NIS}

Uploading Bills

Upload Multiple Bills

This method allows you to upload one or more bills for existing students. You may upload multiple bills for the same student, or bills for multiple students, at the same time.

{"bill_upload_list":
 [
  {
  "bill_key":"001",
  "account_code":"BCA SMK TELKOM",
  "bill_component_name":"SPP Desember",
  "expiry_date":"2018-12-11T00:00:00Z",
  "due_date":"2018-12-10T00:00:00Z",
  "active_date":"2018-01-01T00:00:00Z",
  "amount":100000,
  "penalty_amount":1000,
  "notes":"999"
  },
  {
  "bill_key":"001",
  "account_code":"BCA SMK TELKOM",
  "bill_component_name":"Uang Antar Jemput Desember",
  "expiry_date":"2018-12-11T00:00:00Z",
  "due_date":"2018-12-10T00:00:00Z",
  "active_date":"2018-01-01T00:00:00Z",
  "amount":75000,
  "penalty_amount":1000,
  "notes":"999"
  }
 ]
}
$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{"bill_upload_list":
 [
  {
  "bill_key":"001",
  "account_code":"BCA SMK TELKOM",
  "bill_component_name":"SPP Desember",
  "expiry_date":"2018-12-11T00:00:00Z",
  "due_date":"2018-12-10T00:00:00Z",
  "active_date":"2018-01-01T00:00:00Z",
  "amount":100000,
  "penalty_amount":1000,
  "notes":"999"
  },
  {
  "bill_key":"001",
  "account_code":"BCA SMK TELKOM",
  "bill_component_name":"Uang Antar Jemput Desember",
  "expiry_date":"2018-12-11T00:00:00Z",
  "due_date":"2018-12-10T00:00:00Z",
  "active_date":"2018-01-01T00:00:00Z",
  "amount":75000,
  "penalty_amount":1000,
  "notes":"999"
  }
 ]
}');

$request->setRequestUrl('https://testclient.infradigital.io/bill_component/batch');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders(array(
  'authorization' => 'Basic MDAwMDI6MGMyYjJlYWE0N2RlNmJjYjE0NGQ4M2VhNWQ2ODMzZjQ2ZWViNGZkY2ZiOGI3NTJiYWRiYTRiOTFmYjRlNTZjMw==',
  'content-type' => 'application/json'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

The above command returns a 201 response on success

HTTP Request

POST https://testclient.infradigital.io/bill_component/batch

Query Parameters

Parameter Mandatory Description
bill_key true Student NIS
account_code true Account Code (destination of funds)
bill_component_name true A description of the bill, eg "SPP Bulan Mei"
expiry_date true Student Name
due_date true Student Name
active_date false The date upon which this bill becomes active
amount true The amount of the bill in rupiah
penalty_amount false The penalty applied if the bill is paid after the due date
notes false Optional notes to be saved related to this bill

Querying Bills

Search Bills

This API lets you search bills within your school according to search criteria. In addition we also provide some specific examples of common queries in the next sections. If there is no search criteria or query parameters, then by default the system will return 50 latest bills.

GET https://biller:pwd@client.infradigital.io/bill_component/search/biller?state=provisioned&account_code=BCA&ref_number=KHJG21&start_payment_date=20180320&end_payment_date=20180320&start_due_date=20180320&end_due_date=20180320&offset=0&limit=50
$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://testclient.infradigital.io/bill_component/search/biller');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString(array(
  'state' => 'provisioned',
  'account_code' => 'BCA',
  'ref_number' => 'KHJG21',
  'start_payment_date' => '20180320',
  'end_payment_date' => '20180320',
  'start_due_date' => '20180320',
  'end_due_date' => '20180320',
  'offset' => '0',
  'limit' => '50',
  'notes' => '999'
)));

$request->setHeaders(array(
  'authorization' => 'Basic MDAwMDI6MGMyYjJlYWE0N2RlNmJjYjE0NGQ4M2VhNWQ2ODMzZjQ2ZWViNGZkY2ZiOGI3NTJiYWRiYTRiOTFmYjRlNTZjMw=='
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

The above command returns an array of bills that match the query.

HTTP Request

GET https://testclient.infradigital.io/bill_component/search/biller

Query Parameters

Parameter Mandatory Description
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

Get a Students Bills

This allows you to query bills belonging to a particular student

GET https://biller:pwd@testclient.infradigital.io/bill_component/search/bill?bill_key=0001
$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://testclient.infradigital.io/bill_component/search/bill?bill_key=0001');
$request->setRequestMethod('GET');
$request->setHeaders(array(
  'authorization' => 'Basic MDAwMDI6MGMyYjJlYWE0N2RlNmJjYjE0NGQ4M2VhNWQ2ODMzZjQ2ZWViNGZkY2ZiOGI3NTJiYWRiYTRiOTFmYjRlNTZjMw=='
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

The above command returns a 200 response on success

HTTP Request

GET https://testclient.infradigital.io/bill

Query Parameters

Parameter Mandatory Description
bill_key true 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

Search: Payments on a date range

A custom search that returns all of the bills paid on a specified date range.

GET https://biller:pwd@client.infradigital.io/bill_component/search/biller?state=paid&start_payment_date=20180101&end_payment_date=20180131&limit=20
$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://testclient.infradigital.io/bill_component/search/biller');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString(array(
  'state' => 'paid',
  'start_payment_date' => '20180101',
  'end_payment_date' => '201800131',
  'limit' => '20'
)));

$request->setHeaders(array(
  'authorization' => 'Basic MDAwMDI6MGMyYjJlYWE0N2RlNmJjYjE0NGQ4M2VhNWQ2ODMzZjQ2ZWViNGZkY2ZiOGI3NTJiYWRiYTRiOTFmYjRlNTZjMw=='
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

Date is in format YYYYMMDD

HTTP Request

GET https://testclient.infradigital.io/bill_component/search/biller

Search: All unpaid bills

A custom search that returns all of the outstanding bills.

GET https://biller:pwd@client.infradigital.io/bill_component/search/biller?state=provisioned&limit=500
$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://testclient.infradigital.io/biller/bill_component/search/biller');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString(array(
  'state' => 'provisioned',
  'limit' => '500'
)));

$request->setHeaders(array(
  'authorization' => 'Basic MDAwMDI6MGMyYjJlYWE0N2RlNmJjYjE0NGQ4M2VhNWQ2ODMzZjQ2ZWViNGZkY2ZiOGI3NTJiYWRiYTRiOTFmYjRlNTZjMw=='
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

HTTP Request

GET https://testclient.infradigital.io/biller/bill_component/search/biller

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