Is it possible to integrate custom payment gateway

Hi there,
I am from Srilanka .In my country Paypal,Cyperber ,and Stripe are not available.
I need to integrate custom payment gateway.Is there are any code sample to integrate custom payment gateway.