<?php
/**
 * Expire Pending Payments Cron
 */
if (php_sapi_name() !== 'cli') die('CLI only');

require_once dirname(__DIR__) . '/config/config.php';
require_once dirname(__DIR__) . '/config/database.php';

try {
    dbQuery("UPDATE payments SET status = 'expired' WHERE status = 'pending' AND created_at < DATE_SUB(NOW(), INTERVAL 30 MINUTE)");
    echo "Done\n";
} catch (Exception $e) {
    echo "Error: " . $e->getMessage() . "\n";
}
