· 9 years ago · Aug 26, 2016, 07:48 AM
1$data = array(
2 "type" => "updatebilling",
3 // "client_id" => "00018",
4 "client_id" => "11988",
5 "trx_id" => $trx_id,
6 "customer_name" => $driver->name." - Rp ".number_format($nominal, 2,',','.'),
7 "datetime_expired" => $datetime_expired,
8 "description" => "Update Billing"
9 );
10
11 // $client_id = '00018'; //client id from BNI
12 $client_id = '11988'; //client id from BNI
13 $secret_key = '64c78a3506a18479031840acf1e7d2b0'; // secret key from BNI
14
15 $hashdata = \BniHashing::hashData($data, $client_id, $secret_key);
16 $data = array("client_id" => $client_id, "data" => $hashdata);
17 $_data = json_encode($data);
18
19 $curl = curl_init();
20 curl_setopt_array($curl, array(
21 CURLOPT_URL => "https://api.bni-ecollection.com/",
22 CURLOPT_RETURNTRANSFER => true,
23 CURLOPT_ENCODING => "",
24 CURLOPT_MAXREDIRS => 10,
25 CURLOPT_TIMEOUT => 20,
26 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
27 CURLOPT_CUSTOMREQUEST => "POST",
28 CURLOPT_SSLVERSION => 6,
29 CURLOPT_POSTFIELDS => $_data,
30 CURLOPT_HTTPHEADER => array(
31 "Content-Type: application/json",
32 )
33 ));
34
35 $response = curl_exec($curl);
36 $err = curl_error($curl);
37
38 curl_close($curl);