After sitting down with them and agreeing to work on the problem with them, immediately send them an invoice for either the whole estimation (billable in incremental milestones) or a block of hours (sic., as little as 4h)
It’s okay to ask for a portion in advance (up to half of the first milestone or project cost for instance.)
Do the work. Send a revised invoice with every milestone completion indicating how much paid, remaining, and due for the increment.
Remember to add 25% of expected project hours to cover project overhead (meetings, administrivia, communications. One should not underestimate the time consuming nature of phone calls and emails.)
Once you agree to do the work bill for absolutely everything. Do not be shy.
If something is your fault (misattributed or identified activity, took longer than you thought necessary) absorb it into your costs. If anything is their fault (fickle, high maintenance, poor communications) bill them. You will be respected for aggressive billing (if you do good work) and taken advantage of for yielding (no matter how good the work). Don’t be shy with money, they won’t be shy about expectations.
Good luck!
I'll need it. It's tough out here!
This isn't an alternative to the more concrete process yepyoukno mentioned- it's just an additional idea. In the age of AI, teams are dramatically scaling down (whether this be ir/rational is a different topic). There is a risk that no one is open to having to working with another developer (and paying them) unless you contribute something truly creative, such as a unique take on a problem they're experiencing (lots of info on the web). Rooting for you!!