We can apply conservation of momentum in both the directions. Since there is a collision in the direction of line joining the centers we apply Newton's law of collision which involves restitution.
We cannot conserve momentum of single body, because the collision of the other body is nothing but external force.