false,'error'=>'method_not_allowed'], 405); } $input = read_json_body(); $endpoint = trim((string)($input['endpoint'] ?? '')); if ($endpoint === '') { json_response(['ok'=>false,'error'=>'bad_params'], 400); } try { $stmt = $pdo->prepare(" UPDATE push_subscriptions SET is_active = 0, updated_at = NOW() WHERE endpoint = :e AND compte_id = :cid "); $stmt->execute([ ':e' => $endpoint, ':cid' => (int)($_SESSION['compte_id'] ?? 0), ]); json_response(['ok'=>true]); } catch (Throwable $e) { error_log('push unsubscribe error: '.$e->getMessage()); json_response(['ok'=>false,'error'=>'server_error'], 500); }