The driver can ask you to pay cash, and you can refuse. Nothing illegal there. If the ride is already in progress or the destination is reached, and then the driver asks for cash, once again you can refuse. The driver must then either let you out now or take you to the destination and let you out.