An invoice is a legal document, and it affects the P&L of the issuer and receiver, so this question matters to both parties! Which said, there isn't one unambiguously right answer - you should agree this with the client and get appropriate professional advice.
This may be a conditional arrangement: you will invoice a given amount as, if and when certain criteria are met. In this case, I would include narrative with your invoice that summarises the progression in this future, conditional obligation - it was $X, it is now $X+Y. As the figure grows, you will want to discuss what that means for both businesses and head off potential conflict (for instance, what do you do if the revenue, when it comes, isn't sufficient to cover the total?).
Or it may be a timing-based arrangement: it is simply that the total invoice includes one element due on normal terms and another to be paid at a future time. If this is the intention, I would look to agree fixed extended terms for this element - so that, for instance, if the expectation is that your client will be profitable in 6 months, you offer 7 months to pay the 'long dated' element of each invoice. That way, after a fixed period, all being well, your client will owe you the deferred amounts not as a single sum but as a series of due payments with the same frequency as the present invoices are being raised - which is simple to plan. When this time comes round, if they are still pre-revenue you will need to negotiate.
Related to this choice is the question of ownership of your work. You should think through the failure case, when you no longer expect to be paid the second 50%. Do you want to assert rights in the code? Again, it's possible to craft agreements so that, for instance,
- Ownership passes with payment of the first (50%) figure
- Ownership passes with payment of the second figure but there are no restrictions on its usage in the meantime
- As 2, but until the second payment, there are restrictions (for instance, no third party is to be allowed access etc)
In all cases, you will certainly want to discuss this with your accountant and possibly with your lawyer. It's possible to accidentally create agreements that give rise to audit and tax problems.
Complicated as all this can be, I think this is an excellent type of arrangement - sitting somewhere between standard commercial fee-for-service and full risk-sharing equity deals. Your client has access to your skills at a commercial rate but in a way that creates affordability appropriate to their present situation; you are bearing some risk but if your judgement on that risk is well-founded, you are optimising your position in the medium term.
In an ideal world, you would always address these details up-front. But with goodwill, there's nothing wrong with getting working with a loose agreement and then firming that up so each party knows where they stand.