added beginnings of stripe payment for subscriptions

This commit is contained in:
Oscar Cao
2025-01-19 21:20:12 +00:00
parent c0afafd07b
commit b8624c94a1
13 changed files with 81 additions and 2 deletions

21
ui/static/checkout.js Normal file
View File

@@ -0,0 +1,21 @@
const stripe = Stripe("pk_test_51QikGlGk6yuk3uA8MT3uQrPMpUqJlKzkxfbrfrd34yXolWSbJYEFWm674s2aUydZyjjS0W2oByEJTV0LXMs1pWTk002ioHxQl6");
initialize();
// Create a Checkout Session
async function initialize() {
const fetchClientSecret = async () => {
const response = await fetch("/create-checkout-session", {
method: "POST",
});
const { clientSecret } = await response.json();
return clientSecret;
};
const checkout = await stripe.initEmbeddedCheckout({
fetchClientSecret,
});
// Mount Checkout
checkout.mount('#checkout');
}