Jamie McGeechan, from Ayr, was on a 12-hour stopover in Jakarta on his way home from Australia when immigration officers detained him.
The penniless 28-year-old, who had no cash or credit cards with him, almost missed his connecting flight in the incident last month and was only released when he paid for a 30-day arrivals visa.
But British Embassy officials later confirmed that he should not have to pay for a visa if he was just in transit through the airport.
Jamie had just arrived at Jakarta's Soekarno-Hatta International Airport from Perth, Australia, where he had been for two weeks visiting a friend, when he was approached by security staff and immigration officers, who demanded he paid US $25, about £15, for the visa.
Jamie said: "They told me I would have to buy an arrivals visa because I was going to be in the airport more than six hours, but I didn't have any money on me or in my bank account. I now know it was a bit daft to travel without any money but I didn't think I would need a 30-day arrivals visa if I had no intentions of actually leaving the airport."
Jamie, a musician, claims officials took his passport, wouldn't allow him to use a phone to contact his family, and didn't contact the airline he was due to fly with next or the British Embassy in Jakarta.
He then says a local man wearing the uniform of the airline he had just flown with – Jetstar – approached him, claimed to be an employee, and offered him his mobile phone to call his parents.
Jamie said: "I called my mum and told her what had happened and the guy spoke to her and said if she put money in his bank account, he would buy the visa for me.
"But he was asking for more money, first it was $50, then he said he wanted $100, he wouldn't explain what the extra cost was for or why it had to go into his personal bank account."
Jamie's mother, Rosie, alarmed at the request, transferred money into her son's bank account instead and contacted the British Embassy in Jakarta for help.
She said: "They were very concerned for my son and said he shouldn't have to pay any visa money as he was in transit."
Rosie said immigration officials also refused to speak to staff at the embassy and kept putting the phone down on her when she called them.
Just two hours before his connecting flight was due to leave Jamie was eventually released after the money cleared and he $25 for the visa.
He said: "I was praying for the money to come through in time as they were talking about deporting me to Australia or putting me in a cell.
"I was so scared, nobody spoke English very well and I didn't know what was going to happen."
Jamie is now relieved to be back in Scotland.
He said: "When I got back to Glasgow I had the biggest smile on my face ever."
Budget Australian airline Jetstar has since investigated and found no evidence the local who demanded even more money from Jamie was an employee.
A spokeswoman said: "All Jetstar employees need to be in uniform and display identification.
"In addition, airline personnel do not work inside immigration control.
"Jetstar is sympathetic to the situation and reminds customers to seek their guidance if they require assistance liaising with the proper local authorities."
Rosie, who is housebound with multiple sclerosis, thinks her son was the victim of an attempted scam by the man posing as Jetstar employee.
She said: "It was one of the worst moments in my life, I thought I wasn't going to see my son again, I felt so powerless. He was a young guy on his own, I feel they just decided that he would be the target that day."
She now thinks more information should be made available to travellers.
She said: "I feel travel companies don't give out this information and most kids won't look up the foreign office website to find out."
Tom Hall, editor of travel guide lonelyplanet.com, agreed. He said: "Our guides always include a dangers and annoyances section which details common scams in the area. The best precautions to take are to research the destination you are visiting before you travel and take out travel insurance."
The Indonesian Government has promised to investigate. A spokesman for the foreign office said: "We were made aware of the detention of a British national, Jamie McGeechan, at Jakarta Airport on April 4.
"We provided consular assistance to the British national and his family and liaised closely with Indonesian authorities to help resolve the issue."
A spokesman for the Embassy of the Republic of Indonesia in London made the following statement: "We regret that Mr McGeechan had to experience such conditions during his recent transit in Jakarta and would like to emphasise that the incident should not in any way be a reflection of our immigration officials.
"In this regard, we would like to ask Mr McGeechan to share his experience with the embassy so that a proper report can be submitted to the authorities in Indonesia."