0

Is it possible to change the payment method of an existing order to paypal_express?

I found that question https://stackoverflow.com/questions/19425066/how-to-change-payment-method-from-one-to-another-of-the-existing-order-in-magento (How to change payment method from one to another of the existing order in magento by programming way?) but when I use it with paypal_express, I get an exception that the paypal gateway refused my request. Is it possible to just set the data and not make another request since the payment via paypal has already been made?

0

Following code change only payment method without any payment request:

$order = Mage::getModel('sales/order')->load(204);
$payment = $order->getPayment();
$payment->setMethod('paypal_express');
$payment->setLastTransId('6B7489418T8040620');
$payment->save();
  • wow that was easy, tanks. I had a pretty similar code until now. Do you also know, how I could set the last_trans_id? Unfortunately, I can't use $payment->importData(..) since this method is not existing in that context. – alexandre Mar 29 '17 at 16:51
  • Check updated answer – Sohel Rana Mar 29 '17 at 17:21

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.