I am working on implementing a new payment module using Magento 2.1.6 and want to understand the core concept behind this logic. I know I have to extend from Payment_Model_AbstractMethod or any of its children classes, but my problem is How does the payment module flow work (which functions are called specifically when pressing checkout and place order buttons). When to use and how to use capture and authorize methods in my model.
Finally, how can i check the transaction status is it failed or success?
Magento – Custom Payment Method in Magento 2
authorizecaptchacheckoutmagento-2.1payment-methods
Best Answer
When place order button press from checkout. It's call following class
Then
Now open Magento/Quote/Model/QuoteManagement.php look placeOrder method. Now look following method in same class.
Now open Magento/Sales/Model/Service/OrderService.php place method.
Now open Magento/Sales/Model/Order.php
Look $this->getPayment()->place(); this is the main method who is responsible for payment.
Now open Magento/Sales/Model/Order/Payment.php
This line return actual payment method class object
Check this line here call actual class method