"In this building, you can pay minerals in exchange for sweet loot!"
The refinery is a building unlocked at starbase level 3, which allows you to turn minerals into presents similar to the mystery cubes. It has three options for creating gifts, each of which requires consumption of a certain percent of your maximum amount of minerals, so the cost varies depending on your mineral storage. Each present also has a timer, showing when it will be created, with the perfect present taking two days, the imperfect present taking sixteen hours, and the flawed present taking 8 hours. Remember that only one present may be created at once, so choose carefully.
Also to be remembered is that the refinery has very little loot when attacked, so there is no reason to place it around your main base, or even defend it!