And any business can refuse methods of payment, except cash in certain states and cities.
I believe it's wide open, you could say only accept gold bars and feral chickens for instance.(https://money.stackexchange.com/questions/77001/can-i-accept...)
The argument is that me buying a sandwich for $10 could also be validly viewed as the sandwich shop buying a $10 bill from me with the currency of a sandwich. Thus the method of payment is as subject to variation as the product being exchanged.
The robust utility of cash and why this isn't usually done is that I can have two $10 banknotes, one crisp and well preserved and the other ragged, dogeared and blemished but for the sake of the transaction they are both worth exactly $10 without any negotiation. That's a fairly unique property of money, it doesn't lose value with wear and tear or defects.
Anyways, when it comes to accepted payments, vendors are given a lot of liberties
In this case the thing to do is take the prescription to another pharmacy and use GoodRx there without giving them your insurance information. It sounds like this pharmacy acted in bad faith and that would be worth reporting to the pharmacy board.