I would like to know the flow of calls to various methods in
payment method of magento. Like when do
refund() etc. gets called? And what could be the possible scenario which may influence it (if any)?
Almost all payment methods provide functionality to block and then to get the money from customer. Also you can return money back.
Usually workflow is like this:
- Creating order -
authorize()- money are blocked on customers account but still are there.
- Creating invoice -
capture()- block money are transferred from customers to your account
- Creating credit memo -
refund()- amount is returned to customers account.
Some payment methods you can configure to process
capture() during creating order at the same time.