This vexes many of us ...
On the retractable kind, it should be possible to hold it fully retracted with, say, a gear puller, and then drill a pilot hole into which a pin could temporarily be inserted (as you do with some routers, etc.) ...if the outer and inner parts rotate with respect to one another, you might have to put indexing marks on them to line them up easily.
On the pin kind, vise grips do work, but may be awkward. The pin type is, in some ways easier anyway. Ideally, the pin would be longer with a detent slot and the ability to push it in and shift it sideways so the detent caught.
In either case, you would have to remember to disengage.
There are PTO extenders that would probably allow you to convert easily from retractable to pin. Here is one
Speeco/Farmex 03028 PTO Extender w/ Quick Release 21 Spline 1000 RPM: 1-3/8"x21 (F) to 1-3/8"x21 (M) which would be amenable to the vise grip thing
However, as I was learning the hard way, the real problem turns out to be the fact that you must have the implement raised (and centered left-to-right) so that the two pto shafts (tractor and implement) are "co-axial" ...that is they line up perfectly ...that and a well lubed tractor shaft make all the difference.
The other thing I found (my tractor is an HST w. a live pto) is that the tractor must be off to allow its pto shaft to turn ...surprise! Of course, it is safe practice to have the tractor off when coupling (I don't need to hear from the safety police) but the tractor needs to be on until you get the alignment just right.