inital check in
This commit is contained in:
24
schasite/static/main.js
Normal file
24
schasite/static/main.js
Normal file
@@ -0,0 +1,24 @@
|
||||
// static/main.js
|
||||
|
||||
console.log("Sanity Check");
|
||||
|
||||
fetch("/schasite/config/")
|
||||
.then((result) => {return result.json(); })
|
||||
.then((data) => {
|
||||
const stripe = Stripe(data.publicKey);
|
||||
|
||||
// Event Handler
|
||||
document.querySelector("#submitBtn").addEventListener("click", () => {
|
||||
// Get Checkout Session ID
|
||||
fetch("/schasite/create-checkout-session/")
|
||||
.then((result) => { return result.json(); })
|
||||
.then((data) => {
|
||||
console.log(data);
|
||||
// Redirect to Stripe Checkout
|
||||
return stripe.redirectToCheckout({sessionId: data.sessionId})
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user