Calling a Stripe checkout form from a link rather than button on Leadpages -
is there way modify default stripe checkout script work link element on leadpage?
if use default code place blue button standard on existing button:
<form action="" method="post"> <script src="https://checkout.stripe.com/checkout.js" class="stripe-button" data-key="pk_test_nd6tw8x8xxhbynabeajzpbwq" data-amount="2000" data-name="demo site" data-description="2 widgets ($20.00)" data-image="/128x128.png"> </script> </form>
i've tried using custom button code, below, can see id allowed, not class, how link coded.
<script src="https://checkout.stripe.com/checkout.js"></script> <button id="custombutton">purchase</button> <script> var handler = stripecheckout.configure({ key: 'pk_test_nd6tw8x8xxhbynabeajzpbwq', image: '/square-image.png', token: function(token) { } }); document.getelementbyid('custombutton').addeventlistener('click', function(e) { handler.open({ name: 'demo site', description: '2 widgets ($20.00)', amount: 2000 }); e.preventdefault(); }); window.addeventlistener('popstate', function() { handler.close(); }); </script>
is there way link element on leadpages have checkout script on without involving separate page on site?
the new example uses jquery makes easier find element of choice.
https://stripe.com/docs/checkout#integration-custom
in head tag tracking codes:
<script src="https://checkout.stripe.com/checkout.js"></script>
in end-of-body:
<script> var handler = stripecheckout.configure({ // ... example ... }); $('.cta-btn').on('click', function(e) { // open checkout further options handler.open({ // ... own info here ... }); e.preventdefault(); }); // close checkout on page navigation $(window).on('popstate', function() { handler.close(); }); </script>
you'll have figure out right css selector, in template looking @ button uses "cta-btn" css class, put ".cta-btn" in target of jquery search.
set url of button whatever want, maybe this:
javascript:alert('please enable javascript or change browsers , try again.')
this should dialog pop up.
Comments
Post a Comment