I don't believe Descartes makes the assertion that animals don't experience pain.
He argues that they are machines and have no soul etc, but simple experiments (which he did) would show that they experience pain.
Please note that I am speaking of thought, and not of life or
sensation. I do not deny life to animals, since I regard it as
consisting simply in the heat of the heart; and I do not even deny
sensation, in so far as it depends on a bodily organ.
The question is where he draws the line between bodily "sensation" and mental(soul) "feeling"
It's fine to cause the "sensation" of pain in animals because they are simply machines and have no moral agency.
They don't have the "feeling" of pain because they have no mind. But "feeling" here means the soul consciously thinking about the "sensation" in some muddled dualist way. Not the common meaning of "owch! I feel pain!"