I would like to know the flow of calls to various methods in payment method of magento. Like when do authorize(), capture(), 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 authorize() and capture() during creating order at the same time.

  • thanks for your time to reply but I'm working on a payment gateway where capture() is being called before authorize(). So I'm looking for where from these capture() or authorize() first get called – Mohammad Faisal Feb 25 '14 at 4:41
  • Please do not change the way how magento calls authorize() and capture() methods. Try to think more abstract. Magento's authorize is blocking money and capture is getting them. If your payment's gateway has different names for this actions as magento, you still can process gateways capture in magento's authorize and gateways authorize in mageto's capture. – oleksii.svarychevskyi Feb 25 '14 at 8:14
  • Well I'd not changed the way of magento method call but in my case capture() is being called first. How could I find what's wrong there? – Mohammad Faisal Feb 25 '14 at 9:02
  • What happened when you create order in frontend? – oleksii.svarychevskyi Feb 25 '14 at 9:12
  • there's a cc form as it extends Mage_Payment_Model_Method_Cc and after click on Place Order my order gets submitted. In my payment gateway account there is an entry for that too. I tried logging as Mage::log() in capture() and authorize(). so, in my log file there an entry from capture() then after authorize(). Currently I'm working in sandbox mode – Mohammad Faisal Feb 25 '14 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.