My bank has this feature where the same card has two PIN codes. The PINs are coupled to different bank-accounts, the PIN determining which account will be charged.
So groceries I pay with 111222, coffee-to-go with 333111...
My bank does the rest. All easily analysable and exportable.