Translation:The man was in the midst of paying when the waiter ran.
"When" gives a logical connection between the two clauses. "I smiled when you came home." - I smiled because you were here now.
"As", like "while", connect the two clauses just in a temporal manner. "I smiled as you came home." - You saw me smiling when you came home, but maybe not because of you.
That said, there's a huge gray area there. Danish doesn't make that kind of difference, so you could translate it with either conjunction.