diff --git a/api/chat.php b/api/chat.php index 3475fa2..8cc4d61 100644 --- a/api/chat.php +++ b/api/chat.php @@ -1,6 +1,8 @@ prepare("INSERT INTO finance_requests (user_id, type, amount, symbol, payment_method, tx_hash, fiat_amount, fiat_currency, status, ip_address) VALUES (?, 'recharge', ?, ?, ?, ?, ?, ?, 'pending', ?)"); - $stmt->execute([$user_id, $amount, $symbol, $method, $tx_hash, $fiat_amount, $fiat_currency, getRealIP()]); - - echo json_encode(['success' => true, 'id' => $db->lastInsertId()]); + try { + $stmt = $db->prepare("INSERT INTO finance_requests (user_id, type, amount, symbol, payment_method, tx_hash, fiat_amount, fiat_currency, status, ip_address) VALUES (?, 'recharge', ?, ?, ?, ?, ?, ?, 'pending', ?)"); + $stmt->execute([$user_id, $amount, $symbol, $method, $tx_hash, $fiat_amount, $fiat_currency, getRealIP()]); + + echo json_encode(['success' => true, 'id' => $db->lastInsertId()]); + } catch (Exception $e) { + echo json_encode(['success' => false, 'error' => $e->getMessage()]); + } exit; } diff --git a/api/recharge_status.php b/api/recharge_status.php index e6c10ec..f1071ce 100644 --- a/api/recharge_status.php +++ b/api/recharge_status.php @@ -1,6 +1,8 @@