I put in solar panels a little over two years ago. Paid about 24k cash and got about a 7k tax credit. I got in under the old net energy metering (NEM) 2.0 rules in California where Southern California Edison pays me the retail rate for excess power I feed back to them. The net of that is for two years I have paid zero for electricity. Each year I have ended up with about a $170 credit on my annual true-up electric bill. So no regrets here.
As
@bousozoku mentioned, the California Public Utilities Commission changed up the whole solar structure with the power companies in April 2023 by created NEM 3.0, which only reimburses at the wholesale rate. So any extra power you generate back to the power company is credited at around seven cents a kwh rather than the old NEM 2.0 retail rate of 30-40 cents. So unless you pay big bucks for batteries to store your excess power, it is pretty hard to justify solar in California any longer. My system is grandfathered in at the old NEM 2.0 rates for 20 years, so I'm good, but NEM 3.0 really wrecked solar here for most people.
I think the key for you will be what the reimbursement structure is where you live.
Reddit has a pretty active r/solar section that was really helpful when I was researching.