There are already cards like this
See https://www.cibc.com/en/personal-banking/credit-cards/all-credit-cards/tim-hortons-rewards-card.html
You click the button, if you want it to use it as a credit card and then another button to use it as a Tim Hortons card. The magstripe is also dynamic, so the security numbers change each time the button is pressed so it can’t be cloned (and the magstripe is also dead when no button has been pressed). Unfortunately, I’ve had friends who have the card and it stops working every 6 to 12 months and they have to order a new card.