If a government officer asks you for money, what should you do?
This is a broad question and the answer really depends on the context of the request. There are many times when a government officer asking for money is legal and an appropriate request. However, this is not always the case.
The first question following the request for money should be: what is the money for? This will set the stage for the context of the request. It may be for a penalty, tax or other fee perhaps not known by the citizen. A valid request will be easily explained and backed up with legal code or administrative regulations.
If the request is not valid the official will either present a false reason or simply demand the money. If possible record the attempt, but even this presents a time when paying the demand is better in the long run. There are situations in many countries where the stability of the government is questionable at best and paying small amounts to appease local jurisdictions is preferable to incarceration or retaliation. For example, on a trip in Mexico the group I was with was accosted by the local police force. They demanded $1000 or would arrest us for trespassing on government land. We were deep in the interior of Mexico and decided it was easier for us to pay the money and leave the area. We later filed a complaint through the US Embassy on the matter.
In most advanced countries such as the US, UK, Germany, and Japan these requests are rare, but not unheard of, especially when dealing with foreigners. The best answer is to not pay the money. If arrested the political mechanism will usually figure out the situation in short order.