diff --git a/studio/components/interfaces/Billing/Invoices.tsx b/studio/components/interfaces/Billing/Invoices.tsx index 618aaba77ab..19ae2658c85 100644 --- a/studio/components/interfaces/Billing/Invoices.tsx +++ b/studio/components/interfaces/Billing/Invoices.tsx @@ -74,7 +74,14 @@ const Invoices: FC = ({ projectRef }) => { const fetchInvoice = async (invoiceId: string) => { const invoice = await get(`${API_URL}/stripe/invoices/${invoiceId}`) - window.open(invoice.invoice_pdf, '_blank') + if (invoice?.invoice_pdf) { + window.open(invoice.invoice_pdf, '_blank') + } else { + ui.setNotification({ + category: 'info', + message: 'Unable to fetch the selected invoice', + }) + } } return ( diff --git a/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsx b/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsx index c7267766955..a102f419d92 100644 --- a/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsx +++ b/studio/components/interfaces/Organization/InvoicesSettings/InvoicesSettings.tsx @@ -81,7 +81,14 @@ const InvoicesSettings: FC = ({ organization }) => { const fetchInvoice = async (invoiceId: string) => { const invoice = await get(`${API_URL}/stripe/invoices/${invoiceId}`) - window.open(invoice.invoice_pdf, '_blank') + if (invoice?.invoice_pdf) { + window.open(invoice.invoice_pdf, '_blank') + } else { + ui.setNotification({ + category: 'info', + message: 'Unable to fetch the selected invoice', + }) + } } return (