Yes, it is compulsory, as the amount to be paid is calculated on the basis of the route travelled when the card is validated at the departure station.