Can I buy a ticket via the app once I am already on the train, bus, tram or metro?

You need to buy your ticket before starting your trip. It is not possible to buy a ticket during the trip. Tickets purchased after the start of the trip are not valid.