If it is a pastry brought into Japan, you should pay attention to Japan's food safety regulations and entry regulations. Knowing the relevant regulations in advance can avoid bringing food that is not allowed to enter the country or food that exceeds the allowed weight, and avoid unnecessary trouble.
Generally speaking, you can bring pastry gift boxes when you go to Japan, but you should pay attention to the quantity and type you bring in line with relevant regulations.