diff --git a/apps/dashboard/src/@/actions/billing.ts b/apps/dashboard/src/@/actions/billing.ts index 1abca004b60..1eb0a9b78ba 100644 --- a/apps/dashboard/src/@/actions/billing.ts +++ b/apps/dashboard/src/@/actions/billing.ts @@ -109,6 +109,18 @@ export async function getChainInfraCheckoutURL(options: { } const json = await res.json(); + + if ( + "error" in json && + "message" in json.error && + typeof json.error.message === "string" + ) { + return { + error: json.error.message, + status: "error", + } as const; + } + if (!json.result) { return { error: "An unknown error occurred, please try again later.", diff --git a/apps/dashboard/src/app/(app)/(stripe)/utils/billing.ts b/apps/dashboard/src/app/(app)/(stripe)/utils/billing.ts index 16af4bc82f8..302838ce41e 100644 --- a/apps/dashboard/src/app/(app)/(stripe)/utils/billing.ts +++ b/apps/dashboard/src/app/(app)/(stripe)/utils/billing.ts @@ -75,6 +75,18 @@ export async function getBillingCheckoutUrl(options: { } const json = await res.json(); + + if ( + "error" in json && + "message" in json.error && + typeof json.error.message === "string" + ) { + return { + error: json.error.message, + status: "error", + } as const; + } + if (!json.result) { return { error: "An unknown error occurred, please try again later.",