Answered by ZUPAN | Nov. 19, 2019 15:56
No, you don't need any kind of visa and you will be covered by 24 hour visa free transit if Shanghai if Shanghai is your only stop within mainland China and if the immediate places before and after Shanghai are in different countries or eligible territories. For example, if your itinerary is something like this:
Canada - Shanghai - Singapore
or
Taiwan - Shanghai - Paris
Then you are eligible for 24 hour visa free transit.
You are advised to print out your flight tickets and to have those printouts with you. Also, you should book your accommodation in Shanghai in advance and have a printout of your accommodation confirmation with you too.
You will declare at check-in in the country before Shanghai that you will travel to country C via Shanghai using 24 hour visa free transit. After a short inspection, you will be allowed to board the plane. Upon your arrival in Shanghai, you will approach 24 hour visa free transit counter where you will apply for a temporary entry permit by showing them your flight tickets and your accommodation booking confirmation. After that, you will be allowed to exit the airport and to spend your time as you wish until your next flight.