I'm not sure how well this compares to the workflow you're used to in WHMCS, but FOSSBilling keeps track of a client's balance and funds can be added to it.
If an invoice needs to be paid and the client balance covers it, then the system automatically pays that invoice using the existing balance.
You can add funds via the admin panel:
Or the client can do so themselves as well:
If the client adds funds, it'll generate an invoice for them to pay and add the funds to their account on completion. If you add funds via the admin panel, it goes directly into their account without them needing to pay an invoice.