I support oscarb.sol's approach.
I had the same challenge with my app. And after some thought, I ended up letting users claim on their own. This has the added advantage that the users pay the transaction fees, not me. So they can decide in what frequency they claim, to keep fees low.
Also, in my case, I have implemented a two-level approach of "collect" and "claim". Collect will do the math (compounded interest in this case), advance the last_collection timestamp, and collect the amount into a field in their account, e.g. collected_yet_unclaimed: u64
. After they've collected, they can claim any amount from 0 up to collected_yet_unclaimed into their wallet.
That way, doing the math (which is way more complicated in my case than compounded interest) is decoupled from the actual withdrawal.
This is great because often, the user just wants to know how much they've earned so far ("collect") rather than being forced to withdraw every time they check earnings.