diff --git a/src/routes/console/organization-[organization]/billing/paymentHistory.svelte b/src/routes/console/organization-[organization]/billing/paymentHistory.svelte
index 8339ac60b..f667a1da1 100644
--- a/src/routes/console/organization-[organization]/billing/paymentHistory.svelte
+++ b/src/routes/console/organization-[organization]/billing/paymentHistory.svelte
@@ -48,7 +48,8 @@
invoiceList = await sdk.forConsole.billing.listInvoices($page.params.organization, [
Query.limit(limit),
Query.offset(offset),
- Query.orderDesc('$createdAt')
+ Query.orderDesc('$createdAt'),
+ Query.notEqual('status', 'pending')
]);
}
@@ -70,7 +71,7 @@
payments.
- {#if invoiceList.total - 1 > 0}
+ {#if invoiceList?.invoices?.length > 0}
Due Date
@@ -81,109 +82,104 @@
{#each invoiceList?.invoices as invoice, i}
{@const status = invoice.status}
- {#if i !== 0}
-
-
- {toLocaleDate(invoice.dueAt)}
-
-
- {#if invoice?.lastError}
-
- (showFailedError = true)}
- button>
- {status === 'requires_authentication'
- ? 'failed'
- : status}
-
-
-
- The scheduled payment has failed. .
-
-
-
- {:else}
+
+
+ {toLocaleDate(invoice.dueAt)}
+
+
+
+ {#if invoice?.lastError}
+
+ warning={status === 'pending'}
+ on:click={() => (showFailedError = true)}
+ button>
{status === 'requires_authentication'
? 'failed'
: status}
- {/if}
-
-
- {formatCurrency(invoice.amount)}
-
-
-
-
-
- (showDropdown[i] = !showDropdown[i])}
- event="view_invoice">
- View invoice
-
- {
- showDropdown[i] = !showDropdown[i];
- }}
- event="download_invoice">
- Download PDF
-
- {#if status === 'overdue' || status === 'failed'}
-
+ The scheduled payment has failed.
- {/if}
+ showFailedError = false;
+ }}>Try again.
+
-
-
- {/if}
+ {:else}
+
+ {status === 'requires_authentication' ? 'failed' : status}
+
+ {/if}
+
+
+ {formatCurrency(invoice.amount)}
+
+
+
+
+
+ (showDropdown[i] = !showDropdown[i])}
+ event="view_invoice">
+ View invoice
+
+ {
+ showDropdown[i] = !showDropdown[i];
+ }}
+ event="download_invoice">
+ Download PDF
+
+ {#if status === 'overdue' || status === 'failed'}
+ {
+ retryPayment(invoice);
+ showDropdown[i] = !showDropdown[i];
+ trackEvent(`click_retry_payment`, {
+ from: 'button',
+ source: 'billing_invoice_menu'
+ });
+ }}>
+ Retry payment
+
+ {/if}
+
+
+
+
{/each}
diff --git a/src/routes/console/organization-[organization]/billing/planSummary.svelte b/src/routes/console/organization-[organization]/billing/planSummary.svelte
index e1641ac7a..dc70cf5a7 100644
--- a/src/routes/console/organization-[organization]/billing/planSummary.svelte
+++ b/src/routes/console/organization-[organization]/billing/planSummary.svelte
@@ -21,7 +21,8 @@
onMount(async () => {
const invoices = await sdk.forConsole.billing.listInvoices($organization.$id, [
Query.limit(1),
- Query.orderDesc('$createdAt')
+ Query.orderDesc('$createdAt'),
+ Query.equal('status', 'pending')
]);
currentInvoice = invoices.invoices[0];
const members = await sdk.forConsole.teams.listMemberships($organization.$id, []);