The train tickets would be: Buy at the machine in the station, and stamp it in a device at the station. You can also buy tickets on Trenitalia's mobile site or app, and they've recently added a requirement that you check in (via tap on your device) before boarding the train.