/** * Capture payment on Adyen * * @param \Magento\Payment\Model\InfoInterface $payment * @param $amount * @return mixed * @throws \Magento\Framework\Exception\LocalizedException */ public function capture(\Magento\Payment\Model\InfoInterface $payment, $amount) { $pspReference = $this->_getPspReference($payment); $merchantAccount = $this->_adyenHelper->getAdyenAbstractConfigData("merchant_account"); $currency = $payment->getOrder()->getBaseCurrencyCode(); $modificationAmount = array('currency' => $currency, 'value' => $amount); $request = array("merchantAccount" => $merchantAccount, "modificationAmount" => $modificationAmount, "reference" => $payment->getOrder()->getIncrementId(), "originalReference" => $pspReference); // call lib $service = new \Adyen\Service\Modification($this->_client); $result = $service->capture($request); if ($result['response'] != '[capture-received]') { // something went wrong throw new \Magento\Framework\Exception\LocalizedException(__('The capture action failed')); } return $result; }