We investigated the magnetic structure of the heavy fermion compound CePt$_2$In$_7$ below $T_N~=5.34(2)$ K using magnetic resonant X-ray diffraction at ambient pressure. The magnetic order is characterized by a commensurate propagation vector ${k}_{1/2}~=~left( frac{1}{2} , frac{1}{2}, frac{1}{2}right)$ with spins lying in the basal plane. Our measurements did not reveal the presence of an incommensurate order propagating along the high symmetry directions in reciprocal space but cannot exclude other incommensurate modulations or weak scattering intensities. The observed commensurate order can be described equivalently by either a single-${k}$ structure or by a multi-${k}$ structure. Furthermore we explain how a commensurate-only ordering may explain the broad distribution of internal fields observed in nuclear quadrupolar resonance experiments (Sakai et al. 2011, Phys. Rev. B 83 140408) that was previously attributed to an incommensurate order. We also report powder X-ray diffraction showing that the crystallographic structure of CePt$_2$In$_7$ changes monotonically with pressure up to $P~=~7.3$ GPa at room temperature. The determined bulk modulus $B_0~=~81.1(3)$ GPa is similar to the ones of the Ce-115 family. Broad diffraction peaks confirm the presence of pronounced strain in polycrystalline samples of CePt$_2$In$_7$. We discuss how strain effects can lead to different electronic and magnetic properties between polycrystalline and single crystal samples.