In-game Character shop using coins collected in-game

hi, i have a 2d game but i want to implement a system where you can collect coins which are stored and can be used to buy different characters in a shop, how would i implement this?

  1. Store an integer in a class for gold.
  2. Have a UI for the shop
  3. When clicking items in the shop, perform a condition (if class.GetGoldAmount > cost) and then do your logic: class.GetGoldAmount-=cost;
    //add character data to your player