There are many characters in the game and most of them are free. You can unlock additional characters by completing the story mode. In order to purchase a character, you need to speak with them in a hub or buy them from the Character Wheel during Free Play.
The easiest way to unlock any character is by just putting the code in Enter Code option in the Pause Menu and enters the code. Below we have given the codes of the character that you can unlock in LEGO Star Wars: The Force Awakens.
Chief Petty Officer Unamo
Special Forces TIE Pilot
Kaydel Ko Connix
Guavian Security Soldier