<?
$sucursal = $_POST['sucursal'];
$db = $_POST['bdname'];
$id_plan = $_POST['idplan'];
$precio_original = $_POST['precio_original'];
//Iniciamos conexión a la base de datos
include("../../../mysql_connection/mysql_data.php");
$server_data = new serverData;
$servername = $server_data -> getServerName();
$username = $server_data -> getUserName();
$password = $server_data -> getPassword();
$conn = new mysqli($servername,$username,$password, $db);
mysqli_set_charset($conn, 'utf8');
if($id_plan != "" && $id_plan != null && $id_plan != " " && !empty($id_plan)){
    $query="SELECT amount FROM suscripcion_openpay_planes WHERE id_plan = '$id_plan' AND idSucursal = $sucursal";
    $stmt = $conn->prepare($query);
    $stmt->execute();
    $rs = $stmt->get_result();
    $row = $rs->fetch_assoc();
    echo json_encode($row['amount']);
}
else{
    echo $precio_original;
}
?>