How can I create a trial mode?

I want to create a trial mode for my first iOS game so that someone can try the game(play a few levels) before he/she can buy the game.
How can I check if the game is in trial or in full mode? And how can I initiate the purchase process?