In the present work, we have investigated the effect of trapping as a microscopic phenomenon on the formation of solitary structures in the presence of a quantizing magnetic field in an electron-positron-ion (e-p-i) plasma having degenerate electrons and positrons, whereas ions are taken to be classical and cold. We have found that positron concentration, quantizing magnetic field, and finite electron temperature effects not only affect the linear dispersion characteristics of the electrostatic waves under consideration but also have a significant bearing on the propagation of solitary structures in the nonlinear regime. Importantly, the system under consideration has been found to allow the formation of compressive solitary structures only. The work presented here may be beneficial to understand the propagation of nonlinear electrostatic structures in dense astrophysical environments and in intense-laser plasma interactions.