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)?
1 Answer
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 beforeauthorize()
. So I'm looking for where from thesecapture()
orauthorize()
first get called Feb 25, 2014 at 4:41 -
Please do not change the way how magento calls
authorize()
andcapture()
methods. Try to think more abstract. Magento'sauthorize
is blocking money andcapture
is getting them. If your payment's gateway has different names for this actions as magento, you still can process gatewayscapture
in magento'sauthorize
and gatewaysauthorize
in mageto'scapture
. Feb 25, 2014 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? Feb 25, 2014 at 9:02 -
-
there's a
cc
form as it extendsMage_Payment_Model_Method_Cc
and after click onPlace Order
my order gets submitted. In my payment gateway account there is an entry for that too. I tried logging asMage::log()
incapture()
andauthorize()
. so, in my log file there an entry fromcapture()
then afterauthorize()
. Currently I'm working insandbox
mode Feb 25, 2014 at 9:25