If they invent something, ask to speak to the "comisionado", who's their boss. If you didn't do anything they'll usually back down at this point.
You have to be polite at all times of course.
If they take you to see him, the "comisionados" are usually really cool people who don't want to bother anyone who respects the laws.
Of course you have some corrupt ones, who will invent. I've had close encounters with corrupt ones, but nowadays there are a lot fewer of them.
Usually they will not let you go (without a ticket) if you have done something unless you argue in a polite manner for about 20 minutes.
Do NOT offer cash early on to get out of something!
You have to "get to know" them first. They usually indicate that they want "refrescos" (sodas) if they want you to pay. Don't pay more than 20$ if you were speeding, you should get away with 100-200 cordobas (especially if you can show that you don't carry cash).
Extra wallet is not only good for getting robbed, but also proving that you don't carry a lot of cash to bribe!