Hi,
There is. It depends on the payment method you're using as the payment gateway needs to support that capability.
For example, PayPal Pro and Authorize.net in AIM mode both allow for that.
Note that to be able to use them, you need to be in a country supported by PayPal Pro and Authorize.
Also, if the credit card form is on your website, it means that you legally need to have more strigeant measures for PCI compliance:
www.pcisecuritystandards.org/pci_security/
Here is a more readable introduction to this:
magenest.com/en/pci-dss-compliance-payment-gateway/
So because of PCI DSS, it is usually recommended to redirect the customer to the payment gateway for the credit card form so that you don't have to handle the more complex PCI DSS compliance of your website.