Yes, in many cities in Spain, including Barcelona, you can pay for your bus fare using a credit card. The buses are equipped with contactless payment systems that allow you to tap your card when boarding.