Setting the data attribute on the strip button

I can’t figure it out. I checked other questions regarding setting data attributes, it seems quite complicated.

The amount of the strip button is for aesthetics only, I try to set it ("amount of data") every time the user updates the quantity selection window.

Each time I change the quantity, selects a warning, gives the correct amount, and if I check dom, the attribute "amount of data" should be set correctly, but when I click the "Strip" button, the modal shows the default amount of data, i.e. . nothing.

Does anyone know how to do this?

view (form, select input not shown)

<div class="stripe-controls" align="center"> <script src="https://button.stripe.com/v1/button.js" class="stripe-button" data-key="ENV['STRIPE_PUBLIC_KEY'] %>" data-amount=""> </script> </div> 

CoffeeScript

 $ -> $('#order_quantity').click(orderTotal) orderTotal() orderTotal = -> quantity = $('#order_quantity').val() price = $('#ticket-price').data('url') total = quantity * price $('.stripe-button').attr('data-amount', total) alert total 
+8
javascript jquery coffeescript stripe-payments
source share
1 answer

Specify a custom amount using StripeCheckout.open() .

Note. I work at Stripe.

+12
source share

All Articles