Hi Igor,
Welcome to the Moodle dev game! A place to start is https://docs.moodle.org/dev/Tutorial and learn the basics.
Regarding the payment gateway I advice to look at the plugin directory https://moodle.org/plugins/?q=payment , there are several payment gateways already developed.
Best of luck!
Cheers,
Johan