} else { $json->code = "FAIL"; $json->error = $error; } echo json_encode($json); break; case "changePlan": // echo "Start"; if (isset($_POST['email'])) { $email = $_POST['email']; } else { $email = $_SESSION['user_name']; } if (isset($_POST['email'])) { $pass = $_POST['password']; $r = $api->verifyCredentials($_POST['email'], $pass); } else { $pass = $_SESSION['user_pass']; $r = new stdClass(); $r->returnCode = "SUCCESS"; } if ($r->returnCode == "SUCCESS") { $alertMsg = 'You successfully signed up for eClincher '; $paymentId = null; $paymentLicense = $_POST['plan']; $paymentConfig = $api->getUserPaymentConfig($email, SERVER_IDENTIFIER); $previousPlan = null; $paymentState = null; if ($paymentConfig != null && $paymentConfig != '') { if ($paymentConfig->paymentLicense) { $previousPlan = $paymentConfig->paymentLicense;