<?php
declare(strict_types=1);

header('Content-Type: application/json; charset=UTF-8');

require_once __DIR__ . '/bootstrap.php';

try {
    $stmt = $pdo->prepare("
        SELECT id, method_name
        FROM payment_methods
        ORDER BY id ASC
    ");
    $stmt->execute();
    $methods = $stmt->fetchAll();

    echo json_encode([
        "status" => true,
        "data"   => $methods
    ], JSON_UNESCAPED_UNICODE);

} catch (Throwable $e) {
    http_response_code(500);
    echo json_encode([
        "status" => false,
        "error"  => "Payment methods আনতে সমস্যা হয়েছে",
        "msg"    => $e->getMessage()
    ], JSON_UNESCAPED_UNICODE);
}