<?php
header("Content-Type: application/json; charset=UTF-8");
error_reporting(E_ALL);
ini_set('display_errors', 1);

require_once 'config/database.php';
$db = getDB();
$db->set_charset("utf8mb4");

$query = "SELECT bkash_number, instructions_en, instructions_bn FROM payment_settings WHERE id = 1 LIMIT 1";
$result = $db->query($query);

if ($result && $row = $result->fetch_assoc()) {
    echo json_encode([
        "success" => true,
        "payment_info" => [
            "number" => $row['bkash_number'],
            "instructions_en" => $row['instructions_en'],
            "instructions_bn" => $row['instructions_bn']
        ]
    ], JSON_UNESCAPED_UNICODE);
} else {
    echo json_encode([
        "success" => false,
        "message" => "Configuration profiles missing"
    ]);
}