There are ticket machines available in the Bari Airport train station where you can use cash or a major credit card to purchase your one-way ticket into the city. Just remember to get the ticket validated at the station before you attempt to get on board a train.