I have requirement that for X product. Payment will be Authorized & Capture later. For other products it should be captured immediately.

So when user checkout with Paypal then i have to do this changes.


public function getPaymentAction()
    return $this->_getDataOrConfig('payment_action');

My only concern is which function should I override on basis of my condition?


For paypal express Magento/Paypal/Model/Api/Nvp.php class is responsible for process request and response.

Magento first call callSetExpressCheckout, it return token and this token is use for next nvp process.

Then check following:

Now go with following class Magento/Sales/Model/Order/Payment.php

 * Authorize or authorize and capture payment on gateway, if applicable
 * This method is supposed to be called only when order is placed
 * @return $this
 * @SuppressWarnings(PHPMD.NPathComplexity)
 * @SuppressWarnings(PHPMD.CyclomaticComplexity)
public function place()

Check following line

$action = $methodInstance->getConfigPaymentAction();

More Detail 1

More detail 2

  • Nope It already went to Paypal. Check for AJAX request <path>/magento/paypal/express/gettoken/?button=0&_=1489052120354 Before it goes to Paypal we need to change that – Jackson Mar 9 '17 at 9:37
  • For express check out Magento/Paypal/Model/Api/Nvp.php class is responsible for request and response. – Sohel Rana Mar 9 '17 at 9:54
  • Magento/Paypal/Model/Express/Checkout.php :: start – Sohel Rana Mar 9 '17 at 9:54
  • In Nvp.php public function call( ?? – Jackson Mar 9 '17 at 9:57
  • 1
    Check updated answer – Sohel Rana Mar 9 '17 at 10:05

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.