core: allow users with credits but no payment method to access zen mode

This commit is contained in:
Dax Raad
2026-04-19 01:57:16 -04:00
parent fc0588954b
commit 40834fdf2f

View File

@@ -762,7 +762,7 @@ export async function handler(
const billing = authInfo.billing
const billingUrl = `https://opencode.ai/workspace/${authInfo.workspaceID}/billing`
const membersUrl = `https://opencode.ai/workspace/${authInfo.workspaceID}/members`
if (!billing.paymentMethodID) throw new CreditsError(t("zen.api.error.noPaymentMethod", { billingUrl }))
if (!billing.paymentMethodID && billing.balance <= 0) throw new CreditsError(t("zen.api.error.noPaymentMethod", { billingUrl }))
if (billing.balance <= 0) throw new CreditsError(t("zen.api.error.insufficientBalance", { billingUrl }))
const now = new Date()