For example, last I was advised (a while back), if you are an individual you can only accept payment via stock options (and no other compensation) if you can qualify as an accredited investor (SEC rule). This might have changed with some of that rule changes in the past few years, so you should check it.
If you are a corporation (LLC/C/S Corp) the rules are different and at least from what I remember more flexible.
My 2 cents having done this in the past, 98% of the time you take stock and get no pay off in the end. I stopped doing these deals even with funded/backed startups because I never made my money back. FWIW I did find other deal structures which let me get paid more consistently and that wasn't tied to their stock/options. This would still let them get my services now when they needed them, in turn for a future payoff for me. Usually you want to tie it to revenue numbers (via a rev share), or the next round etc. And I charged a premium for this, and didn't discount since I was taking the larger risk.
Possibly even more complex activities like contributing code etc.