CHECKOUT API
FOR SIA INTEGRATION

  • STUDENT REGISTRATION API BIAYA PENDAFTARAN SISWA API

    This API allows you to create bills at the instant a student registered on your site. Once you have collected their details, your server can call this API to retrieve a payment code your user can use to pay their registration fees. Please note this is a server side API and it cannot be triggered from client side Javascript. Dengan API ini Anda bisa membuat tagihan pada saat siswa mendaftar dari website sekolah. PERHATIAN - API ini khusus untuk server Anda dan tidak bisa dipanggil dari client side Javascript.

    This API is recommended for schools that have their own website, where students usually register. API ini khusus untuk sekolah yang sudah mempunyai website sendiri, dimana siswa bisa mendaftar secara online.

    MATERIAL

    • Source code of the PHP demo available here. Source code PHP Demo dapat diunduh disini.
    • The Infradigital team can help, get in touch via email. Tim Infradigital siap membantu, hubungi kami melalui email.

    AUTHENTICATION AUTHENTICATION

    IDN staff will provide you with a username and password. First we will encode your Password with this method: Tim IDN akan memberikan username and password Anda. Paswword Anda akan di encode dengan metode berikut ini:

    password = SHA256(SHA256(password) + current date with format YYYYMMDD);

    Example with username: user1 and password: abc123 Contoh dengan username: user1 dan password: abc123

    username = user1; 
    password = SHA256(SHA256(abc123) + 20170817);

    PHP example with username: user1 and password: abc123 Contoh PHP dengan username: user1 dan password: abc123

    $password = '123'; 
    $password = hash('sha256', hash('sha256', $password) . date('Ymd'));
  • CREATE BILL MEMBUAT TAGIHAN BARU

    With authentication in place, its time to create a bill. This is the typical structure: Setelah otentikasi selesai, saatnya mencoba untuk membuat tagihan baru. Berikut ini bentuk strukturnya:

    POST https://biller:pwd@client.infradigital.io/bill/checkout 
    { "name":"Bob", //REQ STRING Student Name "bill_key_value":"9990000111", //REQ STRING Student Number "phone":,"081808039547" //OPT STRING Student Phone Number "email":"bob@gmail.com", //OPT STRING Student Email "description":"bob@gmail.com", //OPT STRING Optional Freeform "bill_upload_list": //REQ ARRAY List of components [ { "account_code":"BCA", //REQ STRING Dest. Account "bill_component_name":"Biaya Pendaftaran", //REQ STRING Name of charge "expiry_date":"2017-12-31T00:00:00Z", //REQ TIMEST Expiry Date "due_date":"2017-10-31T00:00:00Z", //REQ TIMEST Due Date < "amount":100000, //REQ FLOAT Amount (Rp) "penalty_amount":0, //OPT FLOAT Penalty (Rp) "description":0, //OPT FLOAT Optional Freeform }, { << NEXT COMPONENT >> }, …, { << LAST COMPONENT >> } ] }

    PHP Example Contoh PHP

    //DETAILS OF BILL (TAGIHAN)
    $bank = "MEGA";
    $bill_key = "15";
    $bill_detail = "Biaya Pendaftaran";
    $expiry_date = "2018-12-31T00:00:00Z";
    $due_date = "2018-10-31T00:00:00Z";
    $active_date = "2017-10-31T00:00:00Z";
    $amount = 10000;
    $penalty = 0;
    $bill_desc = "Pendaftaran Siswa Baru";
    $kodeIDN = '10008';
    
    //API CALL
    $url = 'https://'.$kodeIDN.':'.$password.'@infradigital-cfsbillerapi-dev.herokuapp.com/bill/checkout';
    
    $data = '{
    			"name":"'.$_REQUEST['full_name'].'",
    			"bill_key_value":"'.$bill_key.'",
    			"phone":"'.$_REQUEST['phone'].'",
    			"email":"'.$_REQUEST['email'].'",
    			"description":"'.$_REQUEST['description'].'",
    			"bill_upload_list":
    			[
    				{
    				"account_code":"'.$bank.'",
    				"bill_component_name":"'.$bill_detail.'",
    				"expiry_date":"'.$expiry_date.'",
    				"due_date":"'.$due_date.'",
    				"active_date":"'.$active_date.'",
    				"amount":'.$amount.',
    				"penalty_amount":'.$penalty.',
    				"description":"'.$bill_desc.'"
    				}
    			 ]
    		}';
    
    $curl = curl_init($url);
    
    curl_setopt($curl, CURLOPT_HEADER, false);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER,
            array("Content-type: application/json"));
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); //curl error SSL certificate problem, verify that the CA cert is OK
    
    $result     = curl_exec($curl);
    $response   = json_decode($result, true);
    curl_close($curl);
    
    //RESPONSE
    if ($response["status"] == "Created"){
    	//Display success screen
    }
    ?>
    									
    								

    Bill Upload Lists Bill Upload Lists

    A bill can have one or more components. For example, this could be separate fees (Biaya Pendaftaran, Biaya Gedung, SPP, Biaya buku dll.). Its ok if you just want to include one. Satu bill (tagihan) dapat punya satu atau lebih dari satu bill_component. Misalnya, "Biaya Pendaftaran", "Biaya semester satu", "biaya buku" dll. Jika hanya perlu satu bill_component tidak masalah.

    Each component has the following fields: Setiap bill_component punya field ini:

    • description : “Biaya Pendaftaran”, “Biaya SPP” dll. description : “Biaya Pendaftaran”, “Biaya SPP” dll.
    • expired_date : After this date the bill cannot be paid expired_date : Tagihan tidak bisa dibayar setalah tanggal ini
    • due_date : Two days before this date we send reminders to pay to users due_date : Dua hari sebelum tanggal ini reminder akan dikirim ke user
    • account_code : Your bank account code. IDN staff will give you a unique code for each of your accounts. account_code : Kode Rekening Anda. Tim IDN akan kasih kode unique untuk setiap rekening Anda
    • penalty : If the user pays after the due date but before expiry, this penalty amount (rp) is added to the value of the bill penalty : Kalau user membayar tagihan setelah due date, makanya tagihan ditambah jumlah penalti ini

    Timestamps Timestamps

    All timestamps are ISO formatted, eg: 2017-12-31T00:00:00Z Formatting semua timestamps adalah ISO, misalnya: 2017-12-31T00:00:00Z

    Responses Responses

    The client APIs use HTTPS as protocol and JSON as message format. API ini menggunakan HTTPS untuk protokol dan JSON untuk format message.

    All responses from the client APIs look like this: Semua responses dari API ini ikut format ini:

    {
    	"status": "Not Found",
    	"status_code": 404,
    	"status_desc": "",
    	"data": null
    }
    									
    								
    • status : Message that indicate the overall result, using standard HTTP Response status : Deskripsi keberhasilan transaksi dengan standar HTTP
    • status_code : Code that indicate the overall result, using standard HTTP Response status_code : Kode Response HTTP yang indikasi keberhasilan transaksi ini
    • status_desc : Additional description about the status result status_desc : Deskripsi tambahan tentang keberhasilan / kegagalan
    • data : Contain the data return by the API (if any) data : Data dari panggilan API ini (kalau ada)