In this paper, we study the trapped ion Hamiltonian in three-dimensional (3D) with the generalized potential in the quadrupole field with superposition of the hexapole and octopole fields. We determine new integrable cases by using the Painlevé analysis and find the second and third classical invariants for each P-case. Moreover, we perturb this Hamiltonian by an inverse square potential and we prove that the 3D perturbed Hamiltonian is completely integrable in the sense of Liouville for the special conditions. Quantum invariants are obtained by adding deformation terms, computed using Moyal's bracket, to the corresponding classical counterparts. Furthermore, we use python programming language to plot the third classical invariant, the deformation and the third quantum invariant in phase space for each quantum integrable case in order to confirm the analytical results.