Tickets to Lao Cai are sold at the foreign counter in the main railwaystation. The trains depart from the Hanoi 'B-station'. The border closes at 1700 PM vietnamese - or 1800 AM chinese time. You're passport is stamped. You pay the customs 10.000 dong for a form and you pay another 10.000 dong to cross the bridge.
Chinese immigration is amazingly friendly.
Less than four minutes later we were allowed into China and we never saw any customs. The bank of China in Hekou closes at 1600 PM, but you can change leftover dong in shops to the left of the immigration-office. The hotel opposite the borderbridge changes cash US dollars. For the opposite direction, from Lao Cai to Hanoi , there are two trains, at 9am and at 6pm. In Lao Cai you can get tickets for the same day only.