1document.addEventListener('DOMContentLoaded', function () { 2 const stripe = Stripe(stripe_vars.public_key); 3 const form = document.getElementById('payment-form'); 4 const errorMessage = document.getElementById('error-message'); 5 6 form.addEventListener('submit', async function (e) { 7 e.preventDefault(); 8 9 const product = document.getElementById('product').value; 10 const amount = document.getElementById('amount').value; 11 const customer_name = document.getElementById('customer_name').value; 12 13 try { 14 const response = await fetch('/wp-json/stripe/v1/create-checkout-session', { 15 method: 'POST', 16 headers: { 'Content-Type': 'application/json' }, 17 body: JSON.stringify({ product, amount, customer_name }) 18 }); 19 20 const session = await response.json(); 21 stripe.redirectToCheckout({ sessionId: session.id }); 22 } catch (error) { 23 errorMessage.textContent = 'Error: ' + error.message; 24 } 25 }); 26});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.