Hu Seng, from Chongqing city in southwest China, made a friend tape him into a box that he had paid a courier firm to deliver to his girlfriend, Li Wang, the Daily Mail reported.
Another friend was waiting at his girlfriend's office to film the surprise when he jumped out.
However, the joke was on him when the address was mixed up and instead of 30 minutes in the sealed box, Seng was trapped inside for nearly three hours.
The box had very little air inside and was too thick for Seng to make a hole in it.
By the time the package had arrived at his girlfriend's office, Seng had passed out and had to be revived by paramedics.
"I didn't realise it would take so long," admitted Seng.
More From This Section
"I tried to make a hole in the cardboard but it was too thick and I didn't want to spoil the surprise by shouting," Seng was quoted as saying by the paper.
"If he'd told us what he was doing at the start we would not have taken the parcel. Even when we accept animals they have to go in special containers so they can breathe," a spokesman for the courier firm said.