Files
will 41475f4a5a Add Stripe embedded checkout to book pages
Replaces the gumroad_url stub with an on-site embedded checkout (buy
button -> POST to the bookshop backend -> mounted Stripe iframe),
following the existing contact/submissions form's fetch/status-message
pattern. Adds thank-you and resend-link pages, an example book template
(draft), and updates the privacy policy and terms to honestly disclose
Stripe as a third-party payment processor.
2026-07-14 18:35:50 -04:00

44 lines
1.5 KiB
HTML

{{ define "main" }}
<h1>{{ .Title }}</h1>
{{ .Content }}
<form id="resend-form" style="margin-top:2rem;">
<label for="email">Email</label>
<input type="email" id="email" name="email" required autocomplete="email">
<div class="field-honeypot" aria-hidden="true">
<label for="website">Leave this field empty</label>
<input type="text" id="website" name="website" tabindex="-1" autocomplete="off">
</div>
<button type="submit" class="btn">Resend my link</button>
</form>
<p id="resend-status" role="status" style="margin-top:1rem;"></p>
<script>
(function () {
var form = document.getElementById("resend-form");
var status = document.getElementById("resend-status");
form.addEventListener("submit", function (e) {
e.preventDefault();
var payload = { email: form.email.value, website: form.website.value };
var submitBtn = form.querySelector("button[type=submit]");
submitBtn.disabled = true;
status.textContent = "Sending…";
fetch("{{ .Site.Params.bookshop_base_url }}/books/resend", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload)
}).then(function () {
form.reset();
status.textContent = "If that email has a purchase on file, a new link is on its way.";
}).catch(function () {
status.textContent = "Something went wrong. Try again, or email hello@twosquirrelspress.com directly.";
}).finally(function () {
submitBtn.disabled = false;
});
});
})();
</script>
{{ end }}