forked from 3wordchant/capsul-flask
forest
e9dcf80f6c
fixed a stripe race condition added account balance warning to account balance page
45 lines
1.0 KiB
HTML
45 lines
1.0 KiB
HTML
{% extends 'base.html' %}
|
|
|
|
{% block title %}Pay with Stripe{% endblock %}
|
|
|
|
{% block head %}
|
|
{% if stripe_checkout_session_id %}
|
|
<script src="https://js.stripe.com/v3/"></script>
|
|
{% endif %}
|
|
{% endblock %}
|
|
|
|
|
|
{% block content %}
|
|
<div class="row third-margin">
|
|
<h1>PAY WITH STRIPE</h1>
|
|
</div>
|
|
<div class="row half-margin">
|
|
<form method="post">
|
|
<div class="row justify-start">
|
|
<label for="dollars">$</label>
|
|
<input type="number" id="dollars" name="dollars"></input>
|
|
</div>
|
|
<div class="row justify-end">
|
|
<input type="submit" value="Pay With Stripe">
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
{% if stripe_checkout_session_id %}
|
|
<script>
|
|
Stripe("{{ stripe_public_key }}")
|
|
.redirectToCheckout({
|
|
sessionId: "{{ stripe_checkout_session_id }}",
|
|
})
|
|
.then(function(result) {
|
|
if (result.error) {
|
|
alert("Stripe.redirectToCheckout() failed with: " + result.error.message)
|
|
}
|
|
});
|
|
</script>
|
|
{% endif %}
|
|
|
|
{% endblock %}
|
|
|
|
{% block pagesource %}/templates/stripe.html{% endblock %}
|