There are only a few species of animals that have retractable claws, including all members of the cat family (except cheetahs, whose claws are only semi-retractable), fishers, viverrids and the Japanese Otton frog. While almost all cats have retractable claws, foxes are the only species of dog that possess this feature.
Animals use retractable claws for a number of different reasons, include catching prey, self-defense, digging, climbing and helping them gain traction while running. The claws remain inside the animal until they are needed and are extended by flexing a muscle in the paw. By retracting the claws, the animals can ensure the edges remain sharp and prevent unneeded wear and tear.
In addition to cheetahs, there are also some animals with semi-retractable claws, such as wolverines. Some viverrids (a family that closely resembles and is often mistaken for cats) also have semi-retractable claws, while others, such as genets and civets, have fully retractable claws.
In order to produce its razor-sharp, spiny claws, the Otton frog actually has to pierce its skin with them, unlike other animals whose claws are kept inside a sheath. This means they don't often use their spines, except for fighting over females and during breeding.