0

I was wondering what is the best approach for implementing sale (auth with immediate capture from the gateway) transaction in Magento?

I would like to achieve the best possible compatibility with any potential workflows, 3rd -party observers and configurations.

Should i just call parent::capture(); at the end of my authorize method?

2

Once again, in this great community, i am answering my own question.

After digging through the code, i found the cleanest approach (for run-time configurable transaction type) to be what PayPal actually uses: override getConfigPaymentAction() within your Model and insert a custom logic (based on your module configuration) that returns one of the following types:

const ACTION_ORDER = 'order'; const ACTION_AUTHORIZE = 'authorize'; const ACTION_AUTHORIZE_CAPTURE = 'authorize_capture';

In order to have both sale/capture, you'll need to modify your capture() method to check for previous Auth transactions.

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.