user()->public_id; // BillingClient already short-caches balances; avoid a second long cache layer. try { $minor = $billing->balanceMinor($publicId); } catch (\Throwable) { return response()->json(['available' => false]); } $currency = (string) config('billing.currency', 'GHS'); return response()->json([ 'available' => true, 'balance_minor' => $minor, 'currency' => $currency, 'formatted' => $currency.' '.number_format($minor / 100, 2), ]); } }