Archivo funcional original
public/app.js
El código y las páginas de ejemplo funcionales conservan sus identificadores y textos de muestra originales. La lección y las instrucciones de los archivos los explican en tu idioma.
import { PAYMENT_LINK } from "./config.js";
const a = document.querySelector("#pay"),
s = document.querySelector("[role=status]");
try {
const u = new URL(PAYMENT_LINK);
if (
u.protocol !== "https:" ||
u.hostname !== "buy.stripe.com" ||
!u.pathname.startsWith("/test_") ||
u.href.includes("REPLACE")
)
throw Error();
a.href = u.href;
a.hidden = false;
s.textContent = "Test checkout only. Use Stripe test card details, never a real card.";
} catch {
s.textContent = "Set your own sandbox/test Payment Link in config.js.";
}