They usually don't tell you they do. For example, both Stripe and Square use iFrames; otherwise it's not possible to hide credit card entry from your main application.
There are gateways that redirect you away and return you back after payment, but that's a whole another story.