Payment service providers / gateways typically provide their own API / SDKs in different development languages.
You can also purchase libraries that are already integrated in many of them to quickly implement the solution or launch several payment options. for example: http://www.dotnetcharge.com/
In terms of security, in our experience, it makes sense to integrate in such a way that you transfer the user to a third-party provider for processing, rather than taking or storing credit card information in your own system.
source share