I don't know about iOS, but on Android you can just pay through a Google Pay pop-up, you don't need to input any kind of payment information to the app itself. Does iOS not have such a mechanism?
iOS does and of course you can call an in-app Safari popup to any payment processor or website (with limitations on JavaScript speed) if you don't want to pop them into a browser and then back into the app.
What you’re suggesting is a dangerous anti-pattern.