Generating a receipt page
This commit is contained in:
14
cmd/web/templates/succeeded.page.gohtml
Normal file
14
cmd/web/templates/succeeded.page.gohtml
Normal file
@ -0,0 +1,14 @@
|
||||
{{ template "base" . }}
|
||||
{{ define "title" }}
|
||||
Payment Succedded!
|
||||
{{ end }}
|
||||
{{ define "content" }}
|
||||
<h2 class="mt-5">Payment Succeeded</h2>
|
||||
<hr>
|
||||
<p>Payment Intent: {{ index .Data "pi" }}</p>
|
||||
<p>Cardholder: {{ index .Data "cardholder" }}</p>
|
||||
<p>Email: {{ index .Data "email" }}</p>
|
||||
<p>Payment Method: {{ index .Data "pm" }}</p>
|
||||
<p>Payment Amount: {{ index .Data "pa" }}</p>
|
||||
<p>Currency: {{ index .Data "pc" }}</p>
|
||||
{{ end }}
|
@ -6,7 +6,7 @@ Virtual Terminal
|
||||
<h2 class="mt-3 text-center">Virtual Terminal</h2>
|
||||
<hr>
|
||||
<div class="alert alert-danger text-center d-none" id="card-messages"></div>
|
||||
<form action="/payment-succecded"
|
||||
<form action="/payment-succeeded"
|
||||
method="post"
|
||||
name="charge_form"
|
||||
id="charge_form"
|
||||
@ -149,12 +149,13 @@ function val() {
|
||||
} else if (result.paymentIntent) {
|
||||
if (result.paymentIntent.status === "succeeded") {
|
||||
// we have charged the card
|
||||
document.getElementById("payment_intent").value = result.paymentIntent.id;
|
||||
document.getElementById("payment_method").value = result.paymentIntent.payment_method_types[0];
|
||||
document.getElementById("payment_amount").value = result.paymentIntent.amount;
|
||||
document.getElementById("payment_currency").value = result.paymentIntent.currency;
|
||||
processing.classList.add("d-none");
|
||||
showCardSuccess();
|
||||
// would submit the form
|
||||
document.getElementById("charge_form").submit();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user