Photosynthesis in cactus is slightly different from most plants and happens this way because they live in a very dry climate. Firstly, photosynthesis takes place in the stem, as you correctly say they do not have proper leaves. Secondly they take in carbon dioxide at night and use it the next day for photosynthesis. This means they can keep their stomata closed during the day to stop them losing lots of water. Stomata are tiny holes that they breathe through. In most plants carbon dioxide is taken in during the day and is not stored. This means plants are constantly losing water which evaporates when the stomata are open.