The hearts represent the number of attempts you will have to complete each level.
If you win the level, your balance will not be affected. However, if you fail, one heart will be subtracted from your total.
They will be added to your balance every 30 minutes, until you reach the maximum of five.
You can see how many hearts you currently have at the top of the main screen, between your avatar or profile picture and the coin balance.