You can pay by card at some places in Essaouira, but most places only accept cash. Even my hostel did not accept card payments. There are cash machines just outside the medina.