<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cancel Subscription</title>
<style>
body { font-family: Arial, sans-serif; display: flex; justify-content: center; align-items: center; min-height: 100vh; margin: 0; background: #f5f5f5; }
.box { background: #fff; padding: 40px 50px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.1); text-align: center; max-width: 500px; }
h3 { color: #1a1a2e; margin: 0 0 10px 0; }
p { color: #64748b; margin: 0; font-size: 14px; }
.spinner { border: 3px solid #e2e8f0; border-top: 3px solid #1a1a2e; border-radius: 50%; width: 30px; height: 30px; animation: spin 1s linear infinite; margin: 0 auto 16px; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.error { color: #dc2626; }
.success { color: #15803d; }
#loading { display: block; }
#result-success { display: none; }
#result-error { display: none; }
#result-invalid { display: none; }
</style>
</head>
<body>
<div class="box">
<div id="loading">
<div class="spinner"></div>
<h3>Processing your cancellation...</h3>
<p>Please wait a moment.</p>
</div>
<div id="result-success">
<h3 class="success">Your cancellation has been submitted successfully.</h3>
<p>You will receive a confirmation email shortly.</p>
</div>
<div id="result-error">
<h3 class="error">Unable to process your cancellation.</h3>
<p>Please try again or contact support.</p>
</div>
<div id="result-invalid">
<h3 class="error">Invalid cancellation link.</h3>
<p>Please contact support.</p>
</div>
</div>
<script>
(function() {
var params = new URLSearchParams(window.location.search);
var token = params.get('t');
var loading = document.getElementById('loading');
if (!token) {
loading.style.display = 'none';
document.getElementById('result-invalid').style.display = 'block';
return;
}
fetch('https://windmill-production-fd6c.up.railway.app/api/r/biohealing-cancel-subscription', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ t: token })
})
.then(function() {
loading.style.display = 'none';
document.getElementById('result-success').style.display = 'block';
})
.catch(function() {
loading.style.display = 'none';
document.getElementById('result-error').style.display = 'block';
});
})();
</script>
</body>
</html>