Created
December 14, 2019 07:03
-
-
Save staycreativedesign/b7c07dedb42e4e56fbb0499558bb77f1 to your computer and use it in GitHub Desktop.
what am i expecting to happen : When I run the fetch it returns a client secret which than can be used for down the rabbit hole
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
var form = document.getElementById('payment-form'); | |
form.addEventListener('submit', function(event) { | |
event.preventDefault(); | |
if ($('#amount').not(':empty')){ | |
$("#poker_button").attr("disabled", true); | |
$("#poker_button").html('We are processing your donation, please wait'); | |
$("#poker_button").css('background-color', '#28a745'); | |
}; | |
var response = fetch('/donations/create_payment_intent') | |
.then(function(response) { | |
console.log(response) | |
return response.json(); | |
}) | |
.then(function(responseJson) { | |
var clientSecret = responseJson.client_secret; | |
console.log("foo") | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment