0

We have noticed since upgrading from Magento 1.9 to Magento 2.2.6 that wheres the VAT figure was being passed and stored in the paypal transaction it is not now - always 0 - even though the total figure is correct.

This is an issue as we rely on this for paypal reconciliation with the shop.

Has anyone else found this or know if there is a fix.

See example from this morning.

Paypal transaction without VAT showing Magento 2.2.6 same transaction with VAT

  • Did you trace the issue? Get any log files? – Saravanan DS Mar 11 at 11:32
  • Where would be the best place to look for the paypal API logs? Any help appreciated – ZipNFC Mar 11 at 11:38
0

Try this solution:

Solution to achieve this issue is, Need to override the core magento's Paypal Nvp model file.

Steps are below:

  1. Create a custom module and in the di.xml, define the Paypal function as below:

    <preference for="Magento\Paypal\Model\Api\Nvp" type="Vendor\Namespace\Model\Api\Nvp" />
    
  2. Copy the Magento's Core vendor/magento/module-paypal/Model/Api/Nvp.php to specified path in the di.xml.

  3. You will find the public function call($methodName, array $request) and add the below code in the initial of the function.

if($methodName != 'GetExpressCheckoutDetails'){
   $request['ITEMAMT']=$request['fee'];
}
  1. Add this file in Vendor\Modulename\Model\Total\Fee. Here I used variable fee. Use your custom variable.

It will work now. Add comment if you need clarifications.

  • HI thank you - I will give this a go and get back you - looks good. – ZipNFC Mar 11 at 12:10
  • Please accept this answer if it is worked. – Saravanan DS Mar 11 at 13:31
  • OK so I am getting this exception when making that change: main.CRITICAL: Notice: Undefined index: AMT – ZipNFC Mar 11 at 13:33
  • Made this change - first few lines of function: public function call($methodName, array $request) { if($methodName != 'GetExpressCheckoutDetails'){ $request['ITEMAMT']=$request['AMT']; } $request = $this->_addMethodToRequest($methodName, $request); $eachCallRequest = $this->_prepareEachCallRequest($methodName); – ZipNFC Mar 11 at 13:37
  • Change $request['AMT']; to your variable. – Saravanan DS Mar 11 at 13:55

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.