How to make a coin useable

How do I turn a coin into a currency, I want to make it so that it keeps the coin and so that I use it to buy things in a shop or something.

I want the coin to be collectable but once you buy something it’ll take away the coins. I just want to know how to make it collectable and into a currency, I’ll figure the rest out.

I don’t know what kind of help do you expect.
At first you shoud store the number of coins. In a variable or a file…

when you buy an item in your shop, you have to decrease the number of stored coins…
maybe you convert it before, like 1 coin = 100 credits… but the logic behind should be the same…