You asked
What should I check on a used canon ef 40mm f 2 8 stm before paying?
The site's buying guide doesn't include a lens-by-lens inspection checklist, so it can't tell you what to look for on this particular 40mm. What it does cover is how to buy used safely. Buying used says specialist dealers are the safest route because they test and grade what they sell and usually offer a returns window and warranty. You pay a little more for that. Private sales and marketplaces are cheaper, but the risk is yours. The guide advises meeting in person where you can and testing before you pay.
Be wary of a price far below the market, a seller who won't let you test the lens, and any payment method without buyer protection.
The Canon EF 40mm f/2.8 STM page gives you what to confirm against the listing. It is a Canon EF mount lens, and autofocus is listed as working on the lens itself, so test that on the camera you plan to use. It has no image stabilisation, so there is nothing to test there. It is made for full frame, but it also fits Canon APS-C bodies, where it frames like about 64mm. Check that the body you'll pair it with is one of the listed Canon models.
The page doesn't give a price for this lens, so the site can't tell you whether a seller's asking price is fair.
Written by Claude from this site's pages.
From these pages
This answer is for the question above. Each answer is written for the exact question in its address, so a question with its details in it (a budget, what you shoot, what you already have) gets an answer about those details. An answer draws on all 15 pages of the guide and its catalogue of 320 cameras and 1050 lenses. Another question gets its own answer at its own address, as words after /ask/. Or fill in your own: /ask/which-camera-for-{what-you-shoot}-under-{budget}-euros or /ask/which-lens-for-{what-you-shoot}-on-{your-camera}.