Jump to content

how to solve Fatal Error: id_transaction is null when refunding/cancelling orders


nrvn1

Recommended Posts

When i try to cancel an order and refund the customer via back office (trying to create a credit note at the same time)

it gives me the following error:

Fatal Error: id_transaction is null

 

please help me & tell me exactly how to solve this

 

 

:)

thanks

Link to comment
Share on other sites

  • 2 weeks later...

I have resolved this problem in my PS 1.4.8.2 with Paypal 3.4.8.

 

In the paypal.php file, i have changed for Hook " hookCancelProduct " this line :

$refund = $this->_makeRefund($paypal_order->id_transaction, (int)$order->id, $amount);

By this one :

$refund = $this->_makeRefund($paypal_order['id_transaction'], (int)$order->id, $amount);

 

And it's work for me !

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

Hi,

 

Just want to note that PayPal versions 3.5.0 and 3.5.1 do not fix this problem.

 

Well actually 3.5.1 partially solves this issue in that a "partial refund" will not result in an error. However, this option does not automatically refund the cost of the items to the customer. It merely refunds the product in the backoffice and generates a credit slip. Then it is up to us to log into our paypal account and manually issue the refund.

 

For both versions, using the "standard refund" button results in the same error as above.

 

I will try the fix from above (few posts up) and report back when we get a chance to test. BTW we are on PS v.1.5.4.1. Also, orders with "payment error" are still being created in the BO... somedays we have to cancel a lot of orders because they were created with a payment error status. FYI.

 

Thanks!

Link to comment
Share on other sites

  • 2 weeks later...

Hi Ukoo, also the 3.5 version of PayPal is released. That version should solve the problem as well. You can find it for free here, http://addons.presta...748-paypal.html

 

Hi Benjamin, this doesn't fix the problem. Thymotep fix is the right solution, PayPalOrder::getOrderById returns an array and it should not be used as an object with ->id_transaction but with ['id_transaction'].

Edited by emily_d (see edit history)
Link to comment
Share on other sites

Hi Benjamin, this doesn't fix the problem. Thymotep fix is the right solution, PayPalOrder::getOrderById returns an array and it should not be used as an object with ->id_transaction but with ['id_transaction'].

 

Hi Emily, Which PayPal version are you using? We can do some more investigating and see if we can have a permanent solution.

Link to comment
Share on other sites

Hi Emily, Which PayPal version are you using? We can do some more investigating and see if we can have a permanent solution.

 

The latest one from GitHub (https://github.com/P...ypal/paypal.php).

 

You can see that on two places $paypal_order->id_transaction is accessed like a property with -> notation, but PayPalOrder::getOrderById returns an array so you must access it via its key $paypal_order['id_transaction'].

 

// l. 596, function hookCancelProduct
$refund = $this->_makeRefund($paypal_order->id_transaction, (int)$order->id, $amount);

// l. 1090, function _updatePaymentStatusOfOrder
$response = $paypal_lib->makeCall($this->getAPIURL(), $this->getAPIScript(), 'GetTransactionDetails',
  '&'.http_build_query(array('TRANSACTIONID' => $paypal_order->id_transaction), '', '&'));

 

Also $paypal_order['id_transaction'] is used correctly in other parts of the PayPal class, on lines 1008,1010,1047.

 

I've encountered the problem with the error mentioned in the thread in the hookCancelProduct method but it should be interesting to look at the second problem in method _updatePaymentStatusOfOrder. As far as I can see, _updatePaymentStatusOfOrder is never called. So it should not provoke problems.

Edited by emily_d (see edit history)
Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...

Hi,

 

I confirm that Thymotep's solution works for me too. I use Prestashop v1.4.10 and the module Paypal v3.5.7.

As Emily also noticed, we also need to modify the line 1090 (or 1091 for me).

 

Hi Benjamin, did you try this function ? With all my respect for you and your work, It seems that you should test before answering. There is no investigation to do, it's just an abvious code mistake which goes from versions to other versions of this module without being fixed.

 

Cheers.

Link to comment
Share on other sites

  • 5 weeks later...

Hi,

 

I confirm that Thymotep's solution works for me too. I use Prestashop v1.4.10 and the module Paypal v3.5.7.

As Emily also noticed, we also need to modify the line 1090 (or 1091 for me).

 

Hi Benjamin, did you try this function ? With all my respect for you and your work, It seems that you should test before answering. There is no investigation to do, it's just an abvious code mistake which goes from versions to other versions of this module without being fixed.

 

Cheers.

 

Hi bbgun91, thanks for your feedback. Our developing team does the test and confirms the fix to me. However, there are times that the fixes still have updates. We all work hard to make sure that we provide a quality PayPal module and I apologize for not communicating more thoroughly with you to describe the fixes. This issue should definitely be solved with version 3.6 and if not, please let me know. I will do my best to find a quick resolution. 

Link to comment
Share on other sites

  • 2 weeks later...

I have resolved this problem in my PS 1.4.8.2 with Paypal 3.4.8.

 

In the paypal.php file, i have changed for Hook " hookCancelProduct " this line :

$refund = $this->_makeRefund($paypal_order->id_transaction, (int)$order->id, $amount);
By this one :

$refund = $this->_makeRefund($paypal_order['id_transaction'], (int)$order->id, $amount);
And it's work for me !

 

 

 

Thank you, works fine for me (Prestas 1.4.11 / PayPal 3.6).

 

Rodolphe

  • Like 1
Link to comment
Share on other sites

  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...