(function() { var stripe = Stripe('pk_test_V9IddNo2cU95fDV7dk4n6aVF'); var checkoutButtonStandard = document.getElementById('checkout-button-price_e6b69a9'); var checkoutButtonEconomy = document.getElementById('checkout-button-price_23e07a5'); var checkoutButtonExecutive = document.getElementById('checkout-button-price_969eaf9'); checkoutButtonStandard.addEventListener( 'click', processCheckout ); checkoutButtonEconomy.addEventListener( 'click', processCheckout ); checkoutButtonExecutive.addEventListener( 'click', processCheckout ); function processCheckout() { /* * When the customer clicks on the button, redirect * them to Checkout. */ stripe.redirectToCheckout({ lineItems: [{price: 'price_1IX0LFJauVYUlhhPTgs1RwC7', quantity: 1}], mode: 'subscription', /* * Do not rely on the redirect to the successUrl for fulfilling * purchases, customers may not always reach the success_url after * a successful payment. * Instead use one of the strategies described in * https://stripe.com/docs/payments/checkout/fulfill-orders */ successUrl: 'https://themeforest.net/user/madrasthemes/success', cancelUrl: 'https://themeforest.net/user/madrasthemes/canceled', }) .then(function (result) { if (result.error) { /* * If `redirectToCheckout` fails due to a browser or network * error, display the localized error message to your customer. */ var displayError = document.getElementById('error-message'); displayError.textContent = result.error.message; } }); }; })();