var checkbox = document.getElementById('accept-terms'); var button = document.getElementById('continue-btn'); checkbox.addEventListener('change', function() { button.disabled = !this.checked; }); function proceedToStripe() { button.disabled = true; button.textContent = 'Connecting...'; fetch('/stripe/connect/proceed', { method: 'POST', headers: { 'X-CSRF-Token': document.querySelector('meta[name="csrf-token"]').content } }).then(function(res) { if (!res.ok) throw new Error('Failed to connect'); return res.json(); }).then(function(data) { window.location.href = data.url; }).catch(function() { button.disabled = false; button.textContent = 'Continue to Stripe'; showToast('Something went wrong. Please try again.'); }); }