{% load cms_tags i18n %}

<div class="door-payment-section">
<form action="{% url 'stripeHandler' %}" method="POST" class="my-4">
{% csrf_token %}
<input type="hidden" name="successUrl" value="{% page_url instance.successPage.id %}">
{% if user.is_authenticated %}
  <input type="hidden" name="submissionUser" value="{{ user.id }}">
{% endif %}
{% if invoice %}
  <input type="hidden" name="invoice_id" value="{{ invoice.id }}">
  <input type="hidden" name="stripeAmount" value="{{ invoice.outstandingBalance }}">
{% endif %}

<script
  src="https://checkout.stripe.com/checkout.js" class="stripe-button"
  data-key="{{ stripe_key }}"
  data-name="{{ businessName }}"
  data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
  data-locale="auto"
  data-currency="{{ currencyCode }}"
  {% if invoice %}
      data-amount="{% widthratio invoice.outstandingBalance 1 100 %}"
      data-description="{% trans "Invoice #" %}{{ invoice.id }}"
      {% if invoice.email %}
      data-email="{{ invoice.email }}"
      {% endif %}
  {% endif %}
</script>
</form>
</div>