I try to get actual transaction status in Shopware 6. I try to use this code $paymentStatus = $order->get('transactions')->first()->get('stateMachineState')->get('technicalName'); but here is a problem. transactions have many statuses inside array and if I choose first() sometimes it's wrong status.
For example (it's real example) we have order. The order has 3 transaction statuses in time which a customer held:
- Open
- Cancelled
- Paid
if I use code which was mentioned above I get Cancelled status (because it's first element of array) but I expect Paid. I have only one solution it's sort array by transaction createdAt