Yes, you can absolutely pay your passport fee with a credit card. The U.S. Department of State isn’t living in the Stone Age. They actually accept Visa, Mastercard, American Express, and Discover.
But—and there’s always a but, right?—the devil is in the details. You can’t just hand over your card at the post office and call it a day. You have to follow the exact rules, or you’ll be that person crying in the passport line.