The "pin" goes through the piston, there are holes on both sides to slide it through. In the middle, the pin goes through the needle bearing of the connecting rod (on the left side of the photo). The connecting rod is fixed to the crankshaft (it's not individually replaceable). The diameter of the pin determines the kind of piston and the matching connecting rod, and thereby the connected crankshaft.
Concerning your question: If you only want to replace the piston, you have to make sure you buy one for the correct pin size. If you want to replace the complete engine, it doesn't matter. The ends of the crankshafts are identical, everything will bolt right on.