Magento 2.1 Payment Method

  1. initialize: Instantiate state and set it to state object. Method that will be executed instead of authorize or capture if flag isInitializeNeeded set to true.

  2. validate: Validate payment method information that means validate payment method is allowed for billing country or not.

  3. order: Check order availability.
  4. authorize: Payment process authorize only. After authorize, you need to capture amount manually.
  5. capture: Capture payment amount. When this method called, system automatically capture amount.
  6. refund: Refund specified amount for payment.
  7. cancel: Cancel payment.
  8. void: void specified amount for payment. Some payment method don't allow refund within 24hrs. So in that case you need to call void for refund that amount.

[Update]

Where actually during checkout process does authorize and capture is being called?

Solution:

Open Magento/Sales/Model/Order/Payment.php Check following method.

  1. place
  2. processAction

It's as deprecated approach to extend \Magento\Payment\Model\Method\AbstractMethod, instead, you should use Magento payment gateway.

You can find the step-by-step guide how to implement payment method on Magento 2 dev docs based on Magento payment gateway.

Also, Magento has sale(authorize & capture) payment action - it's similar to authorize, but allows process the capturing action for an authorized transaction. This post describes how to implement sale payment action - https://community.magento.com/t5/Magento-DevBlog/The-Magento-Sale-Payment-Operation/ba-p/67251.