You should start here: https://devnet.kentico.com/articles/developing-custom-payment-gateway It is made for version 7, but it is valid. Some methods probably have changes but the principle is the same. You can download the example code
Kentico has a default PN page for paypal
\CMS\CMSModules\Ecommerce\CMSPages\PayPalIPN.aspx.cs You can find the PN example on GitHub It should give you the idea how to work with paymentinfo.
If you want to make a redirect inside process payment method:
var paymentGatewayUrl = "your url";