Files
manjapro_v6/controller/test_flip.php
T
2025-09-21 21:40:17 +07:00

57 lines
1.6 KiB
PHP

<?php
header("Content-Type: application/json");
$flipKey = "JDJ5JDEzJHlkOFNYckl1a3U3VXJkZERKVnNZL3VTN1BLWmE2U3NMeUJXZC9COFV4LmZlb2VUTmdQaEN5"; // ganti dengan key kamu
$url = "https://bigflip.id/api/v2/disbursement/bank-account-inquiry";
$bank_code = "bri"; // contoh bank
$account_number = "778001005210532"; // contoh no rek
$inquiry_key = uniqid("inq_"); // harus unik setiap request
$data = http_build_query([
"bank_code" => strtolower($bank_code),
"account_number" => $account_number,
"inquiry_key" => $inquiry_key
]);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/x-www-form-urlencoded",
"Accept: application/json; charset=UTF-8",
"Authorization: Basic " . base64_encode($flipKey . ":")
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (curl_errno($ch)) {
echo json_encode([
"status" => false,
"message" => curl_error($ch)
]);
curl_close($ch);
exit;
}
curl_close($ch);
// cek apakah balasan valid JSON
$result = json_decode($response, true);
if (json_last_error() !== JSON_ERROR_NONE) {
echo json_encode([
"status" => false,
"message" => "Respon bukan JSON",
"http" => $httpCode,
"raw" => $response
]);
} else {
echo json_encode([
"status" => true,
"http" => $httpCode,
"response" => $result
]);
}