#vane-wallets
1 messages · Page 1 of 1 (latest)
init();
const stripe = Stripe('pk_test_51DUxSPDOFzB6ZPInyWz1V6XrVxZEEgYJl104nEPoSQCrAZBx4toM7aGt6SGgFDkCICh93YrM1Z7b5gSqWPtl5SOE00IE0TQIkT');
async function init(){
const { clientSecret } = await fetch("scripts/payments.php", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({type: 1, bucks: bucksAmt, stand: stand.checked, email: bucksEmail.value}),
}).then((r) => r.json());
function showMessage(msg){
document.getElementById("payment-message").textContent = msg
}
async function handleSubmit(e) {
e.preventDefault();
creating.hidden = false;
const { error } = await stripe.confirmPayment({
elements,
confirmParams: {
return_url: "http://localhost/paid?stripe",
},
});
if (error.type === "card_error" || error.type === "validation_error") {
showMessage(error.message);
} else {
showMessage("An unexpected error occured.");
}
creating.hidden = true;
}
const elements = stripe.elements({clientSecret,appearance, fonts});
const paymentElement = elements.create('payment');
paymentElement.mount('#payment-element');
some of it
ok! well then you should see the wallets if you're in a browser that supports them https://stripe.com/docs/stripe-js/elements/payment-request-button?html-or-react=html#html-js-testing
you also need to be on a HTTPS page