Is there a way to update payment method of order in magento 2 via dependency Injector or Object factory without using raw sql query?
You need to load
order instance either from order
increment_id. After that, try these code. I haven't tested these code
$payment = $order->getPayment(); $payment->setMethod('yourpaymentmethodcode'); $payment->save(); $order->save();
$order->getPayment()->importData(['method' => 'yourpaymentmethodcode']); $order->save();
I hope this will help