That's how I do it too. Then again, Germans are allegedly very blunt and direct when it comes to such things. My social group certainly is, no shame in offering or accepting. I suppose it's different in other cultures or social groups.
My rule is ask twice, but the second time being a very simple "are you sure? It's OK, I'm happy to contribute / half / cover" (delete as appropriate).
In the UK at least there is still a level of "pride", for want of a better term, with either not accepting charity, or being seen to treat people you care about. There is also an expectation that you should be humble and gracious when receiving a gift so you also should reject it at the first instance. If the offer is only made once then all that is really happening is both sides are playing their parts and nothing else.
The second time is to acknowledge that it was a genuine offer, and not just part of the dance.
If the other person still exists, regardless of what it was, then you accept it. And maybe keep a mental note because next time it would be nice for you to return the favour if they treated you.
I just do like Amy Santiago's mom in Brooklyn 99. Bring a second cooked turkey to thanksgiving in case the host sucks at cooking.
I kid, my usual go to is to refuse twice if someone is trying to give me something I don't want and if they still offer it then the third time I take it to not be rude. I'm pretty good about being firm though, I don't much care if someone thinks I'm being rude if they're being pushy.
I recommend this too. Some of my friends and I take turns paying for things such that we've long forgotten who was first. It makes it so that you always have an excuse to see a friend ("Hey, I owe you a beer!" or "You owe me a beer!"). It's so easy to get sucked into work and life and such, that it's sometimes the little push I need to see them, or the excuse I need to get them to come over.