Answered by ZUPAN | Sep. 02, 2019 15:09
You don't need a visa at all. In case if your cruise itinerary is:
Hong Kong - Shanghai - South Korea
And if there are no additional ports of call within mainland China, you will be definitely eligible for 24 or 144 hour visa free transit in Shanghai. Which one of the mentioned visa free transit options you will use will depend entirely upon the length of your stay in Shanghai. In any case, this does not change the fact that you are eligible for visa free transit in Beijing.
As you already know, you don't need a visa for Hong Kong and the same thing is valid for South Korea and Japan.
I encourage you to study your cruise itinerary once again and you can report here a details that maybe appear to you to be unclear regarding the visa requirements. We will do our best to give you a correct and reliable answer.