Payment gateway for WordPress and Drupal
CiviMember also intersects with the payment plugin, potentially.

But the basic functionality can be built without reference to how it's used.

You'll want to start with this: 

https://docs.civicrm.org/dev/en/latest/extensions/payment-processors/