Contoh BSI Maja / Edupay Dengan API
Silahkan Lihat Kode Berikut , Sesuaikan Dengan User Akun Edupay Anda
/*Web Panel BSI
https://bpi-dev.maja.id/
Username : xxxx
Passeord : xxx
*/
https: //bpi-dev.maja.id/
$client = new Client();
//$url = "https://account.makaramas.com/auth/realms/bpi/protocol/openid-connect/token";
$url = "https://account.makaramas.com/auth/realms/bpi-dev/protocol/openid-connect/token";
$respon = $client->post(
$url,
array(
'form_params' => array(
'grant_type' => 'password',
'client_id' => 'xxxx',
'client_secret' => 'xxxx',
'username' => 'xxxx',
'password' => 'xxxx'
)
)
);
$server_output = $respon->getBody();
$json = json_decode($server_output, true);
//echo print_r($json);
$token = $json["access_token"];
echo "<hr>";
$token2 = $json["refresh_token"];
echo $token;
echo "<hr>";
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
print_r($headers);
echo "<hr>";
//
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://billing-bpi-dev.maja.id/api/v2/register',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{
"date": "' . date("Y-m-d") . '",
"amount": 25000,
"name": "Mahasiswa.' . rand(000, 999) . '",
"email": "-",
"address": "-",
"va": "' . rand(000000, 999999) . '",
"attribute1": "Manajemen Informatika",
"attribute2": "AMKI Ketapang",
"items": [
{
"description": "Daftar Ulang Mahasiswa",
"unitPrice": 25000,
"qty": 1,
"amount": 25000
}
],
"attributes": []
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer ' . $token
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Lanjut Part : 1
Muhammad Ullil Fahri
WA : 089696380422
Tautan WA : https://wa.me/message/SG4YA2XQP5FPE1