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.
Read more