<?php
require_once __DIR__ . '/../config/database.php';

try {
    $conn->query("UPDATE cms_payment_display SET 
        payment_status = 'idle', 
        order_id = 0, 
        order_code = '', 
        customer_name = '', 
        customer_phone = '', 
        total_amount = 0 
    WHERE id = 1");
    
    echo json_encode(['status' => 'success', 'message' => 'State reset.']);
} catch (Exception $e) {
    echo json_encode(['status' => 'error', 'message' => $e->getMessage()]);
}
?>