Last active
November 14, 2018 17:37
-
-
Save staycreativedesign/25ec9f1e3a7b8ea1407177ee4332bca3 to your computer and use it in GitHub Desktop.
Why isnt the email being saved???
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %script{:src => "https://checkout.stripe.com/checkout.js"} | |
| :javascript | |
| var handler = StripeCheckout.configure({ | |
| key: '#{Rails.configuration.stripe[:publishable_key]}', | |
| locale: 'auto', | |
| name: 'foobar', | |
| billingAddress: true, | |
| description: 'Donation', | |
| token: function(token) { | |
| $('input#email').val(token.email); | |
| $('input#stripeToken').val(token.id); | |
| $('form').submit(); | |
| } | |
| }); | |
| $('#donateButton').on('click', function(e) { | |
| e.preventDefault(); | |
| $('#error_explanation').html(''); | |
| var amount = $('input#amount').val(); | |
| amount = amount.replace(/\$/g, '').replace(/\,/g, '') | |
| amount = parseFloat(amount); | |
| if (isNaN(amount)) { | |
| $('#error_explanation').html('<p>Please enter a valid amount in USD ($).</p>'); | |
| } | |
| else if (amount < 5.00) { | |
| $('#error_explanation').html('<p>Donation amount must be at least $5.</p>'); | |
| } | |
| else { | |
| amount = amount * 100; // Needs to be an integer! | |
| handler.open({ | |
| amount: Math.round(amount) | |
| }) | |
| } | |
| }); | |
| $(window).on('popstate', function() { | |
| handler.close(); | |
| }); | |
| $(".donationAmount").click(function(e){ | |
| e.preventDefault(); | |
| da = $(this).data("amount") | |
| $("#amount").val(da) | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #<Stripe::Customer:0x3fd1d3563594 id=abcdefghijklmnop> JSON: { | |
| "id": "abcdefghijklmnop", | |
| "object": "customer", | |
| "created": 1394731627, | |
| "livemode": false, | |
| "description": null, | |
| "email": null, | |
| "delinquent": false, | |
| "metadata": {}, | |
| "sources": {"object":"list","data":[{"id":"card_1234567890ABCDEFghijklmn","object":"card","address_city":null,"address_country":null,"address_line1":null,"address_line1_check":null,"address_line2":null,"address_state":null,"address_zip":null,"address_zip_check":null,"brand":"Visa","country":"US","customer":"abcdefghijklmnop","cvc_check":"pass","dynamic_last4":null,"exp_month":10,"exp_year":2016,"funding":"credit","last4":"4242","metadata":{},"name":null,"tokenization_method":null}],"has_more":false,"total_count":1,"url":"/v1/customers/abcdefghijklmnop/sources"}, | |
| "subscriptions": {"object":"list","count":0,"url":"/v1/customers/abcdefghijklmnop/subscriptions","data":[]}, | |
| "discount": null, | |
| "account_balance": 0, | |
| "currency": "usd", | |
| "default_source": "card_1234567890ABCDEFghijklmn" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment