We study the abundance of star-forming and quiescent galaxies in a sample of 21 clusters at 0.5 < z < 0.7, detected with the Planck satellite. Thanks to the large volume probed by Planck, these systems are extremely massive, and provide an excellent laboratory to study any environmental effects on their galaxies’ properties. We measure the cluster galaxy stellar mass function (SMF), which is a fundamental observable to study and constrain the formation and evolution of galaxies. Our measurements are based on homogeneous and deep multi-band photometry spanning from the u- to the Ks-band for each cluster and are supported by spectroscopic data from different programs. The galaxy population is separated into quiescent and star-forming galaxies based on their rest-frame U-V and V-J colours. The SMF is compared to that of field galaxies at the same redshifts using data from the COSMOS/UltraVISTA survey. We find that the shape of the SMF of star-forming galaxies does not depend on environment, while the SMF of quiescent galaxies has a significantly steeper low-mass slope in the clusters compared to the field. This indicates that a different quenching mechanism is at play in clusters compared to the field, accentuated by a quenched fraction that is much higher in the clusters. We estimate the environmental quenching efficiency (fEQ), that is, the probability for a galaxy that would normally be star forming in the field to be quenched due to its environment. The fEQ shows no stellar-mass dependence in any environment, but it increases from 40% in the cluster outskirts to ∼ 90% in the cluster centres. The radial signature of fEQ provides constraints on where the dominant quenching mechanism operates in these clusters and on what timescale. Exploring these using a simple model based on galaxy orbits obtained from an N-body simulation, we find a clear degeneracy between both parameters. For example, the quenching process may either be triggered on a long (∼3 Gyr) timescale at large radii (r ∼ 8R500), or happen well within 1 Gyr at r < R500. The radius where quenching is triggered is at least rquench > 0.67R500 (95%CL). The ICM density at this location (as probed with XMM-Newton) suggests that ram-pressure stripping of the cold gas is a likely cause of quenching. In addition to this cluster-quenching mechanism, we find that 20-32%, depending on the cluster-specific quenching process, of accreted galaxies were already pre processed (i.e. quenched by the surrounding overdensities) before they fell into the clusters.