-
+ <% } else { %>
+
+ <%
+ const inv = invoice;
+ const isPending = inv.status === 'pending' || inv.status === 'underpaid' || inv.status === 'confirming';
+ const received = parseFloat(inv.amount_received || '0');
+ const total = parseFloat(inv.amount_crypto);
+ const remaining = Math.max(0, total - received);
+ const expiresAt = new Date(inv.expires_at);
+ const now = new Date();
+ const remainingSec = Math.max(0, Math.floor((expiresAt.getTime() - now.getTime()) / 1000));
+ const mins = Math.floor(remainingSec / 60);
+ const secs = remainingSec % 60;
+ %>
+
+ <% if (isPending) { %>
+
+
+ <% } %>
+
+
+
+ <% if (inv.status === 'confirming') { %>
+
+
+ <% } else if (inv.status !== 'paid') { %>
+
+
+

+
+ <% } %>
+
+ <% if (inv.status !== 'paid' && inv.status !== 'expired') { %>
+
+
+
<%= received > 0 && remaining > 0 ? remaining.toFixed(8) : inv.amount_crypto %>
+
<%= inv.coin_label %> (<%= inv.coin_ticker %>)
+
$<%= Number(inv.amount_usd).toFixed(2) %> USD
+
+
+ <% if (received > 0 && remaining > 0) { %>
+
+
-
![QR Code]()
+
Received:
+
<%= received.toFixed(8) %>
-
-
-
-
-
-
-
- Received:
- 0
-
-
- Remaining:
- 0
-
-
-
-
-
-
-
-
-
-
-
- Waiting for payment...
-
-
- Expires in
-
-
-
-
-
-
-
Redirecting to settings...
-
-
-
-
-
- Payment expired
-
-
+
Remaining:
+
<%= remaining.toFixed(8) %>
-
+ <% } %>
+
+
+
+ <%= inv.address %>
+
+ <% } %>
+
+
+ <% if (inv.status === 'pending') { %>
+
+
+ Waiting for payment...
+
+
+ Expires in <%= mins %>:<%= String(secs).padStart(2, '0') %>
+
+
+ <% } else if (inv.status === 'underpaid') { %>
+
+
+ Underpaid — please send the remaining amount
+
+
+ Expires in <%= mins %>:<%= String(secs).padStart(2, '0') %>
+
+
+ <% } else if (inv.status === 'confirming') { %>
+
+
+ Transaction received, waiting for 1 confirmation...
+
+
+ <% } else if (inv.status === 'paid') { %>
+
+
Back to settings
+
+ <% } else if (inv.status === 'expired') { %>
+
+ Payment expired
+
+
Try again
+ <% } %>
+
+