Server : Apache System : Linux 145.162.205.92.host.secureserver.net 5.14.0-611.45.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Apr 1 05:56:53 EDT 2026 x86_64 User : tradze ( 1001) PHP Version : 8.1.34 Disable Function : NONE Directory : /home/tradze/public_html/public/stripe-payment/ |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cart / Checkout</title>
<style>
body {
font-family: Arial;
padding: 30px;
background: #f5f5f5;
}
.container {
max-width: 500px;
margin: auto;
background: #fff;
padding: 20px;
border-radius: 10px;
}
input, button {
width: 100%;
margin-top: 10px;
padding: 10px;
}
button {
background: #000;
color: #fff;
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<h2>Book Appointment</h2>
<input type="text" id="address" placeholder="Address" value="London N3 3JP, UK">
<input type="text" id="postcode" placeholder="Postcode" value="N3 3JP">
<input type="date" id="date" value="2026-03-20">
<input type="time" id="hour" value="16:30">
<input type="number" id="duration" placeholder="Duration" value="129">
<input type="number" id="massage" placeholder="Massage ID" value="137">
<button onclick="createAppointment()">Add to Cart & Checkout</button>
<p id="status"></p>
</div>
<script>
const TOKEN = "wMXtvZtN4GmZNh0rDTPxU5UFMwMheQRkwMpV6vAUAgnWCi2u8cTUER5oQg0i";
async function createAppointment() {
document.getElementById("status").innerText = "Processing...";
try {
const response = await fetch("https://test.tradze.com/api/client/new_appointment", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer " + TOKEN
},
body: JSON.stringify({
postcode: document.getElementById("postcode").value,
address: document.getElementById("address").value,
duration: parseInt(document.getElementById("duration").value),
massage: parseInt(document.getElementById("massage").value),
date: document.getElementById("date").value,
hour: document.getElementById("hour").value,
therapists_opt: "1_th",
selected_therapists: [2536]
}),
credentials: "include"
});
const result = await response.json();
console.log(result);
if (!response.ok) {
document.getElementById("status").innerText = "Error creating appointment";
return;
}
// 👉 Save appointment data for payment page
localStorage.setItem("appointment", JSON.stringify(result));
document.getElementById("status").innerText = "Redirecting to payment...";
// 👉 Redirect
setTimeout(() => {
window.location.href = "payment.html";
}, 1000);
} catch (error) {
console.error(error);
document.getElementById("status").innerText = "Something went wrong!";
}
}
</script>
</body>
</html>