The journey home will be a stressful experience for your hamster, and stress can potentially cause an illness such as wet tail, as well as behavioral problems. You should therefore do everything you can to make your hamster as comfortable as possible on this trip and when settling into its new home.
You will usually be given a container by the pet store or breeder to bring your hamster home in. However, this is likely to be small and uncomfortable, and may even be made out of cardboard which your hamster could potentially chew through. Therefore it is best to prepare your own container.
For your container you can use a small fish tank, a small plastic animal carrier, or a large plastic tub. This should be cleaned first with soapy water and a small amount of bleach, then rinsed and dried thoroughly.
Line the container with some bedding or torn up tissue paper to keep your hamster comfortable. Also place a small amount of food with high moisture content inside, such as a piece of cucumber or apple, with any pips removed. This will ensure your hamster does not get hungry or thirsty on the journey. Do not place a water bottle in the container as it may tip over.
After buying your hamster you should take it home as soon as possible to minimize its stress. If you are driving, try to go the smoothest and quickest way home, whereas if you are walking, try to avoid bouncing the container up and down.
After you arrive home, carefully place your hamster in its prepared cage, then close the cage door and allow your hamster to explore its new habitat on its own. It will probably hide in an enclosed part of the cage, such as its house.
It is important that you do not disturb or attempt to handle your hamster at this point, as it should be left to settle for the first few days. During this period it may spend a lot of time darting around its cage, and also a lot of time sleeping due to the physical exertion. Adding to its stress could potentially cause illness or behavioural problems. However, you should still provide food and water each day as normal.
Eventually your hamster should appear more settled, and you may see it marking its territory by licking its body and rubbing against the sides of the cage. Wait until your hamster appears to have settled into a routine of waking up each evening for food and activities such as exercising and burrowing. At this point you can begin to handle and tame your hamster.